PHP: Strange Array Behaviour After Object Type Casting to Array
问题 When you do array type-casting of json_decode d value (with $assoc = false ), PHP creates an array with string indices: $a = (array)json_decode('{"7":"value1","8":"value2","9":"value3","13":"value4"}'); var_export($a); //array ( // '7' => 'value1', // '8' => 'value2', // '9' => 'value3', // '13' => 'value4', //) And for some reason these indices are not accessible: var_dump(isset($a[7]), isset($a['7'])); //false //false When you try to create the same array by PHP itself, it is being created