首页 > pthread 成员属性为什么不为空

pthread 成员属性为什么不为空

<?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 为什么不是空

【热门文章】
【热门文章】