Backend development

Stage 1 · Lesson 2 of 10

Modern PHP syntax and types

Your language and how HTTP works

Learn PHP 8, not the PHP of old tutorials. Start every file with declare(strict_types=1);. Then a function typed to take an int rejects the string "5", instead of quietly converting it.

Learn typed parameters, return types and properties, and union and nullable types such as ?string (a string or null). Learn , match expressions, (a fixed list of allowed values) and readonly properties. property promotion is worth learning too: it declares and sets properties right in the constructor's signature. Run scripts with php from the terminal.

Common traploose comparison: == converts types before comparing and has surprised PHP developers for years, so use === by default and let strict types catch mistakes early.

A question to check yourself, an AI practice session and 1 cheat sheet entry come with the full roadmap. Unlock

Resources for this stage

Start with· follow one of these

  • VideoFree
    PHP For Beginners

    Laracasts · Beginner

    Free video series that builds a small app in plain PHP before any framework

  • GuideFree
    PHP: The Right Way

    Josh Lockhart and contributors · Intermediate

    Modern PHP practice in one place: Composer, PSR standards, PDO and security basics

Practise

  • Your language track: small exercises with free mentor feedback on idiomatic code

Keep handy

  • Quick syntax lookups for your language when you forget how something is written

  • Read the HTTP overview, methods, headers and status code pages until they feel obvious

Also worth your time

Mark this stage as not done?