You may want to know that removing semicolon is optional sometime but need to know the condition when it can be removed and when it can't be.
-------------------------------------------------------------------------
// Example 1: PHP script with closing tag at the end.
<?php
// php code
// you can remove semicolon
mysqli_close( $db )
?>
// Example 2: PHP script without closing tag at the end.
<?php
// php code
// you can't remove semicolon
mysqli_close( $db )
-----------------------------------------------------------------------