<?php$things = array((object)array("a"=>1,"aa"=>1), (object)array("a"=>2,"aa"=>2), (object)array("a"=>3,"aa"=>3)); foreach ($things as $thing) { echo $thing->a; // '1' $copyThing = $thing; unset($copyThing->a); echo $thing->a; // undefined } var_dump($things);// your code goes here
Standard input is empty
123array(3) { [0]=> object(stdClass)#1 (1) { ["aa"]=> int(1) } [1]=> object(stdClass)#2 (1) { ["aa"]=> int(2) } [2]=> object(stdClass)#3 (1) { ["aa"]=> int(3) } }
PHP Notice: Undefined property: stdClass::$a in /home/yfAldM/prog.php on line 7 PHP Notice: Undefined property: stdClass::$a in /home/yfAldM/prog.php on line 7 PHP Notice: Undefined property: stdClass::$a in /home/yfAldM/prog.php on line 7
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!