PHP Syntax
Every PHP file starts using:
<?php
Example
<?php
echo "Hello Zyro!";
Statements
Every statement ends with:
;
Example:
$name = "Aayan";
echo $name;
Case Sensitivity
Variables are case-sensitive.
$name = "Aayan";
$Name = "Steve";
These are different.
Whitespace
PHP ignores extra spaces.
$name = "Aayan";
Multiple Statements
echo "Hello";
echo "World";
Embedding HTML
<h1>
<?php
echo "Hello";
?>
</h1>
Best Practice
Always start files with:
<?php
declare(strict_types=1);
Example
<?php
declare(strict_types=1);
echo "Welcome";
Exercises
Create:
echo "Hello World";