So before we start any coding, let's get something out of the way first.
So PHP code is stored inside files with the PHP extension, but you can't just write PHP right away
inside the PHP file.
You actually need a PHP starting tag.
And if you mix PHP with HTML, you also need a closing tag.
You can add multiple of those opening and closing tags inside such document where you can put the PHP
code.
So PHP code actually needs this starting tag all the time.
Even if a file contains only PHP code, that's different from languages like JavaScript or Ruby, where
you can just write code straight away.
Now, in PHP, every statement requires a semicolon at the end.
That's also different with languages like JavaScript, for example, where the semicolon is optional,
or Python where there is no semicolon at all.
You use tabs instead.
So the semicolon is required always, except around the braces.
So if you have an if statement like this, for example the semicolon is not required here.
Now there are some exceptions.
For example when you have this declaration that is telling PHP to use strict types, you don't need
a semicolon here.
You also don't need a semicolon after a namespace declarations, though you can still use it, so it's
easier to just remember to use it at all times except after curly braces.