- Output for 5.5.24 - 5.5.30, 5.6.8 - 5.6.15
- Parse error: syntax error, unexpected '{' in /in/3G5KV on line 7
Process exited with code 255.
<?php
$object = new stdClass();
$object->{'1'} = 'one';
echo $object->{'1'};
$array = (array) $object;
$test = {'1'};
echo $array[test];
//var_dump($array);
/* produces
array(1) {
["1"]=>
string(3) "one"
}
*/
//none of the following will work
$key = '1';
echo $array[1], $array['1'], $array["1"], $array[(string)1], $array[$key];