Introduction to PHP for Os X by Example

How do I write a PHP script?

For the most part PHP is an embeddable scripting language as such all you need to write PHP is a good text editor. For this work shop we will use Xcode 2.0 as our editor. This is a bit like using a hammer to crack a walnut but it still does a great job.

Generally speaking PHP scripts are written into ordinary web pages interspersed amongst standard HTML code. The file is usually saved with a .php extension rather then the usual .html so that the server knows that, that file contains PHP code and therefore will parse the file and hand the PHP code off to the PHP interpreter for processing.