arrays - PHP: Data loss when pass an object -
i have class array of socket
class { public $clients = array(); }
and class b extends thread in constructor pass class .
class b extends thread { private $a; public function __construct($a) { $this->a = $a; } }
next, if add print_r
instruction,
$this->a = $a; print_r($this->a); print_r($a);
i have output $this->a
a object ( [clients] => array ( [0]=> 0 ) )
this output $a
.
a object ( [clients] => array ( [0]=> resource id #n ) )
why lose socket data?
i have tried pass &$a
in construct.
Comments
Post a Comment