PHP Tutorial Basic Syntax_PHP Tutorial

WBOY
Release: 2016-07-21 15:43:25
Original
724 people have browsed it

PHP script blocks begin with . You can place PHP script blocks anywhere in your document.
Of course, on servers that support abbreviations, you can use to start and end script blocks.
However, for best compatibility, we recommend using the standard form (

Copy code The code is as follows:

?>

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

Copy the code The code is as follows:



echo "This is the PHP tutorial website!";
?>
< ;/body>


Every line of code in PHP must end with a semicolon. A semicolon is a delimiter used to separate sets of instructions.
There are two basic commands for outputting text through PHP: echo and print. In the above example, we used the echo statement to output text.
Comments in PHP
In PHP, we use // to write single-line comments, or /* and */ to write large comment blocks.
Copy code The code is as follows:



//This is a comment
/*
This is a large comment,
can comment multiple lines
*/
echo "test string1";
echo "< ;br/>"; //Add "
" here to generate a new line on the Web page, that is, line break
echo "
";
// echo "test string2
";
//echo "test string3
";
echo "test string4
";
?>


www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/320763.htmlTechArticlePHP script block starts with ?php and ends with ?. You can place PHP script blocks anywhere in your document. Of course, on servers that support abbreviations, you can use ? and ? to...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!