3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $json = '{"str":true,"123":true}'; $arr1 = json_decode($json, true); $arr2 = (array)json_decode($json); var_export($arr1); var_export($arr2); var_dump(isset($arr1['str']), isset($arr1['123']), isset($arr2['str']), isset($arr2['123']));
based on sLHGk
Output for 7.2.0
array ( 'str' => true, 123 => true, )array ( 'str' => true, 123 => true, )bool(true) bool(true) bool(true) bool(true)
Output for 5.4.0 - 7.1.10
array ( 'str' => true, 123 => true, )array ( 'str' => true, '123' => true, )bool(true) bool(true) bool(true) bool(false)