I decoded a json string and then Type casted it into any Array and tried to access it later. But it generate Undefined Index
Error
Here is my sample code
$json = '{"1":"Active","0":"Inactive"}'; //Yes, it is a valid Json String
$decodedObject = json_decode($json);
$array = (array)$decodedObject;
echo $array['1']; // This generates undefinded Index 1 Error
Here is the display of the array and object
stdClass Object
(
[1] => Active
[0] => Inactive
)
Array
(
[1] => Active
[0] => Inactive
)