Reputation: 581
when i echo
print_r(array_values(array_filter($exampleArray[5]["Numbers"])));
I get an array which looks like
Array ( [0] => 100
[1] => 31
[2] => 023 )
But when i echo the statement
print_r(array_values(array_filter($exampleArray[5]["Numbers"][0])));
I get
Notice: Undefined offset: 0
Warning: array_filter() expects parameter 1 to be array, null given
Warning: array_values() expects parameter 1 to be array, null given
messages. Clearly there is a 0 index but i don't know why i'm getting errors.
Upvotes: 0
Views: 125
Reputation:
Simple As that $exampleArray[5]["Numbers"][0]
is not an array rather it is a String.
If you want to get the index[0]
value you should call index 0
on array_values
response
print_r(array_values(array_filter($exampleArray[5]["Numbers"]))[0]);
The above code will return 100
Upvotes: 2