Global variable don't change
I want to execute a function in a loop when a condition is reached. This is a simplified version, a file for loop and another for process:

    //loop.php
    while(true){
      if($GLOBALS['send']){
        send(); //This function should be executed only when global var is TRUE
        $GLOBALS['send'] = FALSE;
      }
    }

    //process.php
    if($message_count > 0){
      $GLOBALS['send'] = TRUE;
    }

I'm trying to work with Server-Side Events, the answer to this question help me
http://stackoverflow.com/questions/9070995/html5-server-sent-events-prototyping-ambiguous-error-and-repeated-polling/9361026#9361026
but I'm stuck how to "trigger event" to call function inside the loop.
Thanks in advanced. (excuseme my english)

Global variable don't change
===

I want to execute a function in a loop when a condition is reached. This is a simplified version, a file for loop and another for process:

    //loop.php
    while(true){
      if($GLOBALS['send']){
        send(); //This function should be executed only when global var is TRUE
        $GLOBALS['send'] = FALSE;
      }
    }

    //process.php
    if($message_count > 0){
      $GLOBALS['send'] = TRUE;
    }

I'm trying to work with Server-Side Events, the answer to this question help me
http://stackoverflow.com/questions/9070995/html5-server-sent-events-prototyping-ambiguous-error-and-repeated-polling/9361026#9361026
but I'm stuck how to "trigger event" to call function inside the loop.
Thanks in advanced. (excuseme my english)
