Hello World
Open a PHP block
PHP code lives inside <?php ... ?> tags. A file can mix HTML and PHP later.
<?php
echo "Hello, World!\n";
Run from the CLI
From the folder that contains the file:
php hello.php
View in a browser
With php -S localhost:8000 running, visit http://localhost:8000/hello.php.
Echo and print
echosends output to the response or terminal- Statements usually end with a semicolon
- Omit the closing
?>in pure PHP files to avoid accidental whitespace - Errors appear based on your display/error settings
Comments
One comment per signed-in account. Comments are saved with this page’s URL.