Lesson content
Read, practise, then check your understanding
PHP begins with <?php; pure PHP files normally omit the closing tag. Statements end with semicolons, braces form blocks, and declarations should be organized through Composer autoloading rather than large include chains.
Practical example
<?php
declare(strict_types=1);
require_once dirname(__DIR__) . '/vendor/autoload.php';
function greeting(string $name): string { return "Hello, $name"; }
echo greeting('Mira');
require fails when a file is absent; include warns and continues. Strict types is per-file and affects scalar calls originating there. Separate bootstrap, domain logic, templates, configuration, and HTTP response handling.
Knowledge check
Answer every question correctly to complete this chapter.
0 of 10 checks passed
Your progress is saved on this device.