The PHP script is executed on the server and the plain HTML results are sent back to the browser.
PHP scripts can be placed anywhere in the document.
PHP script starts with <?php and ends with ?> :
<?php// PHP code?>
The default file extension for PHP files is ".php".
PHP files usually contain HTML tags and some PHP script code.
Below, we provide an example of a simple PHP file that outputs the text "Hello World!" to the browser:
<!DOCTYPE html><html><body><h1>My first PHP page</h1> <?php echo "Hello World!" ; ?> </body></html>
Every line of code in PHP must end with a semicolon. A semicolon is a delimiter used to separate sets of instructions.
With PHP, there are two basic commands for outputting text in the browser: echo and print .
<!DOCTYPE html><html><body> <?php// 这是PHP 单行注释/*这是PHP 多行注释*/?>
</body></html>