fork(13) download
  1. <?php
  2.  
  3. $a = array('123' => '123');
  4. $o1 = (object)$a;
  5. $o2 = new stdClass;
  6. $o2->{'123'} = '123'; // setting property is OK
  7.  
  8. echo "123 go: ".$o1->{'123'}."\n"; // error!
  9. echo "123 go: ".$o2->{'123'}."\n"; // works... WTF?
  10.  
Success #stdin #stdout 0.02s 13112KB
stdin
Standard input is empty
stdout
123 go: 
123 go: 123