Editing PHP

From Zen Cart(tm) Wiki
Revision as of 16:00, 19 July 2010 by DrByte (talk | contribs) (removed unfinished comment)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

This article is intended for people who need to learn about PHP.

Read the manual:

First, get a text editor with syntax highlighting. This will help you spot syntax or "parse" errors. Notepad is one free editor with syntax highlighting. Others include Crimson Editor and Xint.

All text must be written within either two single quotes or two double quotes, for example:

echo "This text is enclosed within two double quotes.";

echo 'This text is enclosed within two single quotes (apostrophes).';

If you want to use an apostrophe as a part of your text and you're also using apostrophes to enclose the text, you must escape it. Escaping a character in PHP means putting a backslash in front of it.

For example:

echo 'If we hadn\'t escaped apostrophes in this text, we\'d get a parse error.';

If you use double quotes to mark some text, you would have to escape any of those in your text;

echo "This is a piece of text enclosed within \"double quotes\".";