Every PHP block starts with <?php and ends with ?>. If a file contains only PHP code (such as a class or config file), it is best practice to omit the closing ?> tag so accidental trailing spaces never cause "headers already sent" errors.
echo vs print
echo— Slightly faster, accepts multiple comma-separated arguments, and has no return value (most commonly used).print— Always returns1, accepts only one argument.
ADVERTISEMENT