PHP

Courses

  • PHP for Beginners

    Learn PHP from your first script to handling real form data safely.

    • Beginner
    • 13 lessons
    • 8 hours

Tutorials

  • Arrays

    Indexed and associative arrays, nested arrays, adding and removing items, and the array functions you will use every day.

    • Beginner
    • 4 min read
  • Functions

    Define functions with parameters, defaults and return types, understand scope, and use named arguments, arrow functions and closures.

    • Beginner
    • 5 min read
  • Loops: while, for and foreach

    Learn while, do-while, for and foreach loops in PHP, when to use each one, and how to avoid infinite loops.

    • Beginner
    • 4 min read
  • Handling forms safely

    Build a contact form handler in PHP that validates input, keeps the user’s answers, escapes output, and redirects after a successful POST.

    • Beginner
    • 5 min read
  • Organising code with include and require

    Use include, require and their _once variants, build paths with __DIR__, share templates and configuration, and keep private files out of the web root.

    • Beginner
    • 5 min read
  • Errors, exceptions and debugging

    Understand PHP’s error types, configure error display for development and production, use try/catch with exceptions, and debug with var_dump and logs.

    • Beginner
    • 5 min read
  • What is PHP?

    PHP is a server-side language that builds web pages before they reach the browser. Learn how it works and where it fits.

    • Beginner
    • 3 min read
  • Variables and data types

    Learn how to create variables, the main PHP data types, how type juggling works, and how to switch on strict types.

    • Beginner
    • 4 min read
  • Installing PHP and running your first script

    Get PHP 8 running on your computer, check the version, and run scripts from the terminal and PHP’s built-in web server.

    • Beginner
    • 3 min read
  • PHP syntax: tags, statements, comments and echo

    Learn PHP tags, statements and semicolons, comments, echo and print, and how PHP mixes with HTML.

    • Beginner
    • 4 min read
  • Operators and expressions

    Arithmetic, assignment, comparison, logical and null coalescing operators in PHP, with the comparison traps to avoid.

    • Beginner
    • 4 min read
  • Working with strings

    Single versus double quotes, interpolation, concatenation, heredoc, and the string functions you will use every day, including mb_ functions for non-English text.

    • Beginner
    • 4 min read
  • Making decisions: if, else, switch and match

    Use if, elseif and else, understand truthy and falsy values, and pick between switch and PHP 8’s match expression.

    • Beginner
    • 4 min read