fork download
  1. <?php
  2. $things = array((object)array("a"=>1,"aa"=>1), (object)array("a"=>2,"aa"=>2), (object)array("a"=>3,"aa"=>3));
  3. foreach ($things as $thing) {
  4. echo $thing->a; // '1'
  5. $copyThing = $thing;
  6. unset($copyThing->a);
  7. echo $thing->a; // undefined
  8. }
  9. var_dump($things);
  10. // your code goes here
Success #stdin #stdout #stderr 0.02s 52432KB
stdin
Standard input is empty
stdout
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)
  }
}
stderr
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