I have an array
$array = ['first'=>'hi','second'=>'bye'];
Why following syntax is not working
echo " i wanna print $array['first']";
The error message is
Parse error: syntax error, unexpected '' (T_ENCAPSED_AND_WHITESPACE), expecting identifier (T_STRING) or variable (T_VARIABLE) or number (T_NUM_STRING) in
But when I tried
echo "i wanna print $array[first]";
did work fine.
So can someone explain what difference single quotes (') making here. And what does above error really mean, any ideas?