Setting up and PHP syntax
Environment
- Quick:
php -S localhost:8000in your project folder (PHP's built-in server). - Full stack: Debian with
apt install php php-mysql mariadb-server nginx php-fpm, or XAMPP/Laragon on Windows.
Syntax
<?php
declare(strict_types=1);
$business = "BOSS Pacific";
$year = (int) date("Y");
echo "<h1>Welcome to $business</h1>";
echo "<p>© " . $year . "</p>";
Variables start with $; statements end with ;; strings in double quotes interpolate variables.
Types in PHP 8
int, float, string, bool, array, null, objects — with optional type declarations, union types (int|string), and match expressions.
Rating
0
0
There are no comments for now.