PHP Tutorial basic syntax _ PHP Tutorial

Source: Internet
Author: User
The basic syntax of the PHP Tutorial. PHP script block? Php starts? End. You can place PHP script blocks anywhere in the document. Of course, on servers that support abbreviations, can you use? And? To use the PHP script block End. You can place PHP script blocks anywhere in the document.
Of course, you can use To start and end the script block.
However, we recommend that you use the standard format (

The code is as follows:


?>


PHP files usually contain HTML tags, like an HTML file and some PHP script code.
Below, we provide a simple PHP script, which can output the text "Hello World" to the browser ":

The code is as follows:




Echo "this is PHP Tutorial network! ";
?>



Each line of code in PHP must end with a semicolon. A semicolon is a separator used to differentiate the instruction set.
There are two basic commands for outputting text through PHP: echo and print. In the above example, we use the echo statement to output the text.
Comments in PHP
In PHP, we use // to write single-line comments, or use/* and */to write large comments.

The code is as follows:




// This is a comment
/*
This is a big comment,
Comment multiple lines
*/
Echo "test string1 ";
Echo"
"; // Add here"
"Is to generate a new line on the Web page, that is, line feed.
Echo"
";
// Echo "test string2
";
// Echo "test string3
";
Echo "test string4
";
?>


Http://www.bkjia.com/PHPjc/320763.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/320763.htmlTechArticlePHP script block? Php starts? End. You can place PHP script blocks anywhere in the document. Of course, on servers that support abbreviations, can you use? And? Come...

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.