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 and ?> to start and end script blocks.
However, for best compatibility, we recommend using the standard form (
?>
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
";
?>
http://www.bkjia.com/PHPjc/320763.htmlwww.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...