I have an array stored in a variable--at least I think it is an array--and want to get a value from it.
This is what the $myvar logs as and why I think it is an array:
Array
(
[numberofhits] => 5
)
How can I get the value 5 into a variable?
Have tried some likely possibilities such as
$numhits = $myvar->numberofhits;
But $numhits is empty.
Thanks for any suggestions.
$myvar = (object)$myvar;but that is overkill for what you're trying to do...json_decode()it's just a PHP object or array, and you use the same syntax to access the contents.