fork download
  1. <?php
  2.  
  3. $obj = new stdClass;
  4. $obj->{'1'} = 'foo';
  5. var_dump((array)$obj);
  6.  
  7. $obj = ['0' => 1, 1 => 2, 2 => 3];
  8. var_dump((array)$obj);
Success #stdin #stdout 0.02s 23404KB
stdin
Standard input is empty
stdout
array(1) {
  ["1"]=>
  string(3) "foo"
}
array(3) {
  [0]=>
  int(1)
  [1]=>
  int(2)
  [2]=>
  int(3)
}