Missing semi-colon on guide code?



Hello, so, my code is working well enough, but I am a little confused. I am fairly certain the echo command needs to end in a semi colon. However, in the guide/lesson, there is not a semi-colon at the end of the echo command that references the array statement (specifically "echo $myArray[0]").

In the "hint" area, there IS a semi-colon present. And when I put a semi-colon in my code it was okay. However... it also seemed to work well enough when I didn't add the semi-colon. I am a fan of semi-colons as that seems more organised.

Is there a special case that does not require the semi-colon because it is involving arrays?

Thank you for your time and efforts.

$myArray = array("do", "re", "mi");

echo $myArray[0];       //<----- ?
// outputs "do"



In the normal sense, a semi-colon is mandatory on all PHP statements, with one exception. The last one in a function, or the last one in the global code. The above line would qualify under the latter condition.


Ah! Thank you! That helps a large amount in my understanding why it didn't cause an error!