<?php
class b extends Thread {
public $func = null;
public function run() {
$c = new c();
var_dump($c->listA);
var_dump(c::$listB);
var_dump(c::$hello);
}
}
class c {
public $listA = ['a', 'b', 'c'];
public static $listB = ['a', 'b', 'c'];
public static $hello = 'hello world!';
}
$b = new b();
$b->start();
输出值为:
array(3) {
[0]=>
string(1) "a"
[1]=>
string(1) "b"
[2]=>
string(1) "c"
}
NULL
string(12) "hello world!"
WTF?
大神们,$listB 的数组去哪了?
我使用你的程序,得到的是正确的结果:
环境如下: