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 you use the standard form (
Copy the 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:
< ;?php
echo "This is the PHP tutorial website!";
?>
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 the code The code is as follows:
//This is a comment
/*
This is a large comment,
can comment multiple lines
*/
echo "test string1";
echo "
"; //Adding "
" here is to generate a new line on the Web page, that is, line break
echo "< ;br/>";
//echo "test string2
";
//echo "test string3
";
echo "test string4
";
?> ;
The above introduces the basic syntax of PHP tutorial download PHP tutorial, including the content of PHP tutorial download. I hope it will be helpful to friends who are interested in PHP tutorial.