php-Language Reference-Basic syntax 3.1

Source: Internet
Author: User
Tags processing instruction

First, the start and end tags of the PHP code

1,<?php and?>// Focus

2,<script language= "PHP" > and </script>

3,<? and?>//short label mode, need to open php.ini short_open_tag option

4,<% and%>//asp mode, need to turn on php.ini asp_tags option

The above four kinds of PHP code tags, only recommended 1, the remaining three are just to let you know, to avoid affecting your reading other people's code.

11. <?phpEcho' If you want to serve XHTML or XML documents, does like this ';?>//Mark 12 32. <script language= "PHP" >//Mark 24         Echo‘some editors (like FrontPage) don\ ' t5Like processing instructions ';6</script>7 83. <?Echo' This was the simplest, an SGML processing instruction ';?>//Mark 39<?= expression?> This is a shortcut for"&LT;? echo Expression?> "Ten  One4. <%Echo' Optionally use Asp-style tags '; %>//Mark 4 A<%=$variable;#This was a shortcut for "<% echo ..."%>

Second, in addition to the simple Echo method, you can also use all of PHP's process statements and function calls

1<?PHP2 if($expression) {3?>4<strong>this istrue.</strong>5<?PHP6}Else {7?>8<strong>this isfalse.</strong>9<?PHPTen } One?> A  -<?PHP -  for($i= 0;$i<10;$i++){ the?> -i = <?phpEcho $i;? > <br/> -<?PHP - } +?>

Three, the last?> can be omitted, when a PHP file is very long, very useful

1 <? PHP 2 3 // ... Omitted here 10000 lines 4echo "End without mark are also possible"; 5 // no matter how many <?php appear before, only the last?> can be omitted, the rest must appear in pairs

php-Language Reference-Basic syntax 3.1

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.