To include PHP content, a web page must meet four criteria:

    The page name must have a suffix of .php. If you want to use a four-letter extension, use.phpx as the page name, where x is the version of PHP being used (for example, .php4 )

    You must have the page on a web server with PHP installed. (i.e. the URL must include http://). You can install server software on your own machine for testing purposes; this server will serve only you.

    PHP code must reside between opening and closing PHP tags on the page. Any code outside the tags will be interpreted as standard code (i.e. as HTML, CSS, or JavaScript, depending on the context).

    <? /* opening PHP tag
    closing PHP tag */ ?>

    This is also valid:

    <?php /* opening PHP tag
    closing PHP tag */ ?>

    The PHP code must be valid. Invalid PHP code will typically cause the page to stop displaying correctly, or not display at all.

Enjoy this piece? I invite you to follow me at to learn more.