Separating HTML From PHP Code

The first thing you will notice in all PHP programs is the use of special tags that tell the webserver to have PHP to process the code inside of those tags.

There are a few different versions of the tag that can be used.  The default version is:

<?php
// Code To Be Executed
?>

Any code between these two tags will be processed.  Anything outside of them will not be processed and outputted as it is typed.

There is also a short tag that can be used if you set the short_open_tag value in your php.ini file to 1.  This tag is:

<?
// Code To Be Executed
?>

Leave a Reply

Your email address will not be published. Required fields are marked *