note 119069 modified in class.thread by salathe
| From: | salathe@php.net | Date: | Tue, 02 Aug 2016 12:16:17 +0000 |
| Subject: | note 119069 modified in class.thread by salathe | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-206190@lists.php.net to get a copy of this message | ||
<?php
# ERROR GLOBAL VARIABLES IMPORT
$tester=true;
function tester(){
global $tester;
var_dump($tester);
}
tester(); // PRINT -> bool(true)
class test extends Thread{
public function run(){
global $tester;
tester(); // PRINT -> NULL
}
}
$workers=new test();
$workers->start();
?>
--was--
# ERROR GLOBAL VARIABLES IMPORT
$tester=true;
function tester(){
global $tester;
var_dump($tester);
}
tester(); // PRINT -> bool(true)
class test extends Thread{
public function run(){
global $tester;
tester(); // PRINT -> NULL
}
}
$workers=new test();
$workers->start();
http://php.net/manual/en/class.thread.php