PHP basic syntax: #php学习笔记 #--basic syntax

Source: Internet
Author: User
Tags php code

One, separating from HTML
When PHP parses a file, it looks for a start and end tag, and the tag tells PHP to start and stop interpreting the code. The parsing of this approach allows PHP to be embedded in a variety of documents, which are ignored by the PHP parser for everything except a pair of start and end tags. In most cases, PHP is embedded in an HTML document.
<p>a</p>
<?php Echo ' B ';? >
<p>c</p>
Of course, you can embed a large section of PHP code
<?php
if (1 = = True) {
Echo ' <p>this is true.</p> ';
}else{
Echo ' <p>this is false.</p> ';
}
?>
You can also write the output of Echo,print,print_r.
<p>a</p>
<p><?= ' B '?></p>
<p>c</p>
Second, the instruction separator
PHP is the same as most languages, and every sentence ends with the words ";" Tell the parser I'm done.
Third, note
PHP supports multiple annotation formats
such as C + + style "//comment content"
such as C-style "* * Comment content * * *
such as Shell-style "#注释内容" This article link http://www.cxybl.com/html/wlbc/Php/20130320/37258.html

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.