You are here: Home // Basic syntax

Comments

PHP supports ‘C’, ‘C++’ and Unix shell-style comments. For example: <?php echo "This is a test"; // This is a one-line c++ style comment /* This is a multi line comment yet another line of comment */ echo "This is yet another test"; echo "One Final Test"; # This is shell-style style comment ?> The “one-line” comment

Instruction separation

Instructions are separated the same as in C or perl – terminate each statement with a semicolon. The closing tag (?>) also implies the end of the statement, so the following are equivalent: <?php echo "This is a test"; ?> <?php echo "This is a test" ?>

Escaping from HTML

There are four ways of escaping from HTML and entering “PHP code mode”: Example 5-1. Ways of escaping from HTML 1. <? echo ("this is the simplest, an SGML processing instruction\n"); ?> 2. <?php echo("if you want to serve XML documents, do like this\n"); ?> 3. <script language="php"> echo ("some editors (like FrontPage) don't like
Copyright © 2010 PHP Manual. SiteMap.
Designed by Web Design SiteConstruct. Powered by WordPress.