demosthenes.info

A blog by Dudley Storey on , , , , , , and anything else that strikes his fancy.

featured articles

popular favourites

Basic requirements for a working PHP page

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

  1. 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 )

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

  3. 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).

    1. <? /* opening PHP tag
    2. closing PHP tag */ ?>

    This is also valid, and the more correct method, since it indicates the language used (you’ve seen this format used before, in the <?xml header we've used on our pages:

    1. <?php /* opening PHP tag
    2. closing PHP tag */ ?>
  4. The PHP code must be valid. Invalid PHP code will typically cause the page to stop displaying correctly, or not display at all.

web developer guide

featured comment

by JoelB in Goodbye, JQuery Validation: HTML5 Form Errors With CSS3

what i'm reading

A Storm of Swords: A Song of Ice and Fire: Book Three
A Storm of Swords: A Song of Ice and Fire: Book Three

what i'm watching

Californication: The Third Season
Californication: The Third Season

what i'm playing

Mass Effect 3 Collector's Edition
Mass Effect 3 Collector's Edition

what i'm hearing

Dub FX
Dub FX

blogs

podcasts

no ads ever

This blog is free of advertising, and always will be.

creative commons licensed

The content of this blog is free to use in whatever way you wish under the Creative Commons license.