05.05.2013 Views

Programming PHP

Programming PHP

Programming PHP

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

*/<br />

echo("l=$l m=$m n=$n\n");<br />

?><br />

Now this is regular HTML...<br />

l=12 m=13 n=<br />

Now this is regular HTML...<br />

You can indent, or not indent, comments as you like:<br />

/* There are no<br />

special indenting or spacing<br />

rules that have to be followed, either.<br />

*/<br />

C-style comments can be useful for disabling sections of code. In the following example,<br />

we’ve disabled the second and third statements by including them in a block<br />

comment. To enable the code, all we have to do is remove the comment markers:<br />

$f = 6;<br />

/* $g = 7; # This is a different style of comment<br />

$h = 8;<br />

*/<br />

However, you have to be careful not to attempt to nest block comments:<br />

$i = 9;<br />

/* $j = 10; /* This is a comment */<br />

$k = 11;<br />

Here is some comment text.<br />

*/<br />

In this case, <strong>PHP</strong> tries (and fails) to execute the (non-)statement Here is some comment<br />

text and returns an error.<br />

Literals<br />

A literal is a data value that appears directly in a program. The following are all literals<br />

in <strong>PHP</strong>:<br />

2001<br />

0xFE<br />

1.4142<br />

"Hello World"<br />

'Hi'<br />

true<br />

null<br />

Identifiers<br />

An identifier is simply a name. In <strong>PHP</strong>, identifiers are used to name variables, functions,<br />

constants, and classes. The first character of an identifier must be either an<br />

This is the Title of the Book, eMatter Edition<br />

Copyright © 2002 O’Reilly & Associates, Inc. All rights reserved.<br />

Lexical Structure | 21

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!