<?php
class MyThread extends Thread {
public function run(){
$this->arr = (array)[];
print_r("\$this->arr is " . (empty($this->arr) ? 'empty' : 'not empty') . "\n");
$arr = (array)[];
print_r("\$arr is " . (empty($arr) ? 'empty' : 'not empty') . "\n");
}
}
$thread = new MyThread();
$thread->start();
?>
result:
$this->arr is not empty
$arr is empty
请问成员属性的$arr 为什么不是空