Prev | Current Page 131 | Next

W. Jason Gilmore

"Beginning PHP and MySQL: From Novice to Professional"


CHAPTER 3 ?–  PHP BASICS 57
Figure 3-1. Sample PHP output
Short-Tags
For less motivated typists an even shorter delimiter syntax is available. Known as
short-tags, this syntax forgoes the php reference required in the default syntax. However,
to use this feature, you need to enable PHP??™s short_open_tag directive. An example
follows:
print "This is another PHP example.";
?>
?– Caution Although short-tag delimiters are convenient, keep in mind that they clash with XML, and
thus XHTML, syntax. Therefore, for conformance reasons you shouldn??™t use short-tag syntax.
58 CHAPTER 3 ?–  PHP B ASICS
When short-tags syntax is enabled and you want to quickly escape to and from
PHP to output a bit of dynamic text, you can omit these statements using an output
variation known as short-circuit syntax:

This is functionally equivalent to both of the following variations:


Script
Historically, certain editors, Microsoft??™s FrontPage editor in particular, have had
problems dealing with escape syntax such as that employed by PHP. Therefore,
support for another mainstream delimiter variant,
?– Tip Microsoft??™s FrontPage editor also recognizes ASP-style delimiter syntax, introduced next.


Pages:
119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143