3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $small_num = '9999'; $large_num = '9999999999999999999999999999999'; $arr = (array)json_decode("{\"$small_num\":\"1\",\"$large_num\":\"1\"}"); var_dump($arr); var_dump(array( 'isset_small_num_key' => isset($arr[$small_num]), 'isset_large_num_key' => isset($arr[$large_num]), ));
based on cukZl
Output for 7.2.0
array(2) { [9999]=> string(1) "1" ["9999999999999999999999999999999"]=> string(1) "1" } array(2) { ["isset_small_num_key"]=> bool(true) ["isset_large_num_key"]=> bool(true) }
Output for 5.3.17 - 7.1.10
array(2) { ["9999"]=> string(1) "1" ["9999999999999999999999999999999"]=> string(1) "1" } array(2) { ["isset_small_num_key"]=> bool(false) ["isset_large_num_key"]=> bool(true) }