There is something fundamental I don't understand about PHP arrays. If I create an array and I want to call a value from that array when and why should I use $array->item vs. $array['item']?
My array:
$fruit_qty = array('watermelon' => 3, 'apple' => 5);
If I want the value '5' to print should I use:
echo "Number of Apples: " . $fruit_qty->apple;
vs
echo "Number of Apples: " . $fruit_qty['apple'];
My guess thus far is that $array->item calls a specific value from the array. Whereas, $array['item'] calls and array nested in the array. So I could potentially do $array['sub_array']->value. Is this correct?
$fruit_qty->apple, as you would get Notice: Trying to get property of non-object