"php -S" code example
Example 1: run php server
cd path/to/your/app
php -S localhost:8000
Example 2: php ??
// Example usage for: Null Coalesce Operator
$action = $_POST['action'] ?? 'default';
// The above is identical to this if/else statement
if (isset($_POST['action'])) {
$action = $_POST['action'];
} else {
$action = 'default';
}
Example 3:
<?php
echo "Hello world";
// ... more code
echo "Last statement";
// the script ends here with no PHP closing tag