Microsoft Word - Core PHP Programming Using PHP to Build Dynamic Web Sites

(singke) #1

This method emulates ASP-style tags.


<%=


%>


Unlike other methods, these tags are shorthand for a call to the echo function. This is
probably best illustrated with an example.


<% $name="Leon"; %>
Hi, my name is <%= $name %>.


This method is controlled by compile-time and run-time directives and will only be
available if enabled.


Finally, you can run a script from the command line like:


#! /usr/local/bin/php -q
<? print "hello\n"; ?>


You must compile PHP as a stand-alone executable, of course. The -q tells PHP to be
quiet, to refrain from printing HTTP headers.

Free download pdf