PHP code lives in files with the .php extension. The server processes them before sending HTML to the browser. PHP tags delimit code from HTML:
<?php
echo "Hello, World!";
?>
<!DOCTYPE html>
<html>
<body>
<p><?php echo "The time is: " . date("H:i:s"); ?></p>
</body>
</html>
Test PHP from the command line without a web server:
php -r 'echo "Hello from CLI\n";\'
php my_script.php
Start the built-in development server, perfect for quick testing (never use in production):
php -S localhost:8080
View your PHP configuration including loaded extensions and php.ini path:
<?php phpinfo(); ?>