fork download
  1. <?php
  2.  
  3.  
  4. $obj['a'] = "A";
  5. $obj['b'] = "B";
  6. $obj['c'] = "C";
  7. $obj['get[d]'] = "D";
  8. $obj['get[E]'] = "E";
  9. $obj = (object) $obj;
  10. echo "This is: ".$obj->{'get[d]'}.PHP_EOL;
  11. echo "This is: ".$obj->{'get[E]'}.PHP_EOL;
  12.  
  13. $array = get_object_vars($obj);
  14.  
  15.  
  16. echo "This is: ".$array['get[E]']." but getting from array";
  17.  
Success #stdin #stdout 0.02s 52472KB
stdin
Standard input is empty
stdout
This is: D
This is: E
This is: E but getting from array