3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $array = (array) json_decode('{"a":"1","2":"1","3":"1","4":"1","12":"1"}'); #var_dump($array); #var_dump(array_key_exists('a', $array)); #var_dump(array_key_exists(12, $array)); #var_dump($array[12]); #var_dump($array['12']); #var_dump($array[12]); #$var = (array)json_decode('{"a":"1","2":"1","3":"1","4":"1","12":"1"}'); #var_dump($var['2']); #var_export($var); $var = array('a'=>1, '2'=>2); var_export($var); $var = (object) $var; var_export($var);
based on 3YpPg
Output for 7.3.0beta1
array ( 'a' => 1, 2 => 2, )(object) array( 'a' => 1, '2' => 2, )
Output for 7.2.0 - 7.3.0alpha1
array ( 'a' => 1, 2 => 2, )stdClass::__set_state(array( 'a' => 1, '2' => 2, ))
Output for 5.6.0 - 7.1.20
array ( 'a' => 1, 2 => 2, )stdClass::__set_state(array( 'a' => 1, 2 => 2, ))