PHP Begin Tag, End Tag

By Xah Lee. Date: . Last updated: .

PHP Begin Tag, End Tag

PHP code must be enclosed between delimiters like this

<?php code ?>

Anything outside of it is printed as is.

<?php

echo 5 + 4;

?>

hi there

Save the above as xx.php

You can run it in the command line like this:

php xx.php

or, you can run it in browser thru http server.

Omit PHP Ending Tag

The ending ?> can be omitted if nothing comes after it.