Overview
KB
Learn PHP
PHP techniques
PHP basics
PHP Tutorial
PHP History
Command Line PHP
PHP Syntax
PHP Variables
PHP Superglobals
PHP Strings

PHP Syntax

In order to program in PHP you must abide by the proper PHP syntax. Specifically, this means that a PHP script must:
  • Be a plain-text file
  • Have the correct file extension
  • Use PHP tags to mark the PHP code
  • Format statements, structures, and comments according to exact rules
Although this may sound demanding, one of PHP's greatest strength's is its easy-to-learn syntax.

Plain-Text File

PHP code goes into a plain-text file, which can be created in any text editor, WYSIWYG editor, or IDE, like NuSphere's PhpED. Many applications can be used to program in PHP, but you could not, for example, create a PHP Microsoft Word document (it must be a plain-text file). Furthermore, not all text editors are created equal (Notepad, in particular, is a notably bad editor). Any real PHP programming is best done using a dedicated Integrated Development Environment (IDE), such as NuSphere's PhpED. With it, you'll be able to program more quickly and with less frustration, thanks to features like
  • Code Completion
  • Syntax Highlighting
  • PHP Syntax Checking
  • Function syntax and usage
  • Integrated HTML support
  • Built-in PHP parser
  • A top-notch debugger
You can download the free trial to see this for yourself.

File Extensions

PhpED's new file window
In order for the PHP code to be handled by the Web server, the plain-text file must use a valid file extension. What exactly that extension is depends upon the configuration of the Web server, but .php is almost always a safe choice. Older versions of PHP used .php3 or .phtml. NuSphere's PhpED allows you to use one extension, like .php, for one version of PHP (say PHP 4), and another extension, like .php5, to run a script using a different version of PHP (PHP 5 in this case).

Article continues:  next page>>

 Download NuSphere PHP IDE

Download a free trial of the fast PHP EDitor and robust Integrated Development Environment for PHP.

 Buy NuSphere PhpED® now

Best PHP Editor and complete PHP IDE.
NuSphere PhpED 20.0 is available from our online store front.

 Special Team4 Offer

Get 4 copies of PhpED for the price of 3!

Optimum solution for development teams.
PhpED 20.0 Team4
Need more than 4 licenses? Contact Us for more quantity discounts, please use "Ordering/Payment issue" subject on the form.
"To be honest its bloody awesome, I have looked at loads of PHP editors and this is THE only one that actual works straight out of the box!!! Brilliant, well done."
Andrew Breward,
Director of Technology
caboodal.com