i suppose specific question, reason, when create thread this:
require_once(__dir__.'/myotherfile.php'); class streambufferinput extends thread { public function run(){ global $max_buffer_size; global $data_source; echo "data:" . $max_buffer_size; ... } } myotherfile.php has 2 variables declared in (and can accessed other classes, echo statement here prints data: , nothing else. couldn't find on doing global variables within classes, have global declaration in function of 1 of other classes, , works fine.
edit: here how i'm starting thread.
$stream = new streambufferinput(); $stream->start();
this not possible in php @ moment. cannot access global scope variables defined outside thread within thread itself. however, can execute callable within thread, in global scope using thread::globally, believe achieve want.
you can read more here
Comments
Post a Comment