Here I have a single dimension numeric array
$x = array(1,2,3,4);
Below converted to an object array
$x = (object) $x;
I am not able to access values by its index
echo $x->{'1'} //Tried but not working
Here I have a single dimension numeric array
$x = array(1,2,3,4);
Below converted to an object array
$x = (object) $x;
I am not able to access values by its index
echo $x->{'1'} //Tried but not working
Remove the quotes from the index in the echo statement:
$x = array(1,2,3,4);
$x = (object) $x;
echo $x->{1};
Returns
2