Learn PHP from Scratch

Learn server-side programming with PHP: syntax, functions, arrays, forms, sessions and MySQL with PDO, including the security practices every PHP developer must know.

7 lessonsBeginner to IntermediateFreeLive code examples

Start lesson 1 →

What you will learn

  • Write and run PHP scripts
  • Handle forms and validate input safely
  • Build login systems with sessions
  • Create, read, update and delete data with PDO

Course syllabus

  1. Introduction to PHP: Setup and Your First ScriptLearn what PHP is, how to set up a local server with XAMPP or the built-in server, and write and…
  2. PHP Variables, Data Types and OperatorsLearn PHP variables, data types, string handling, constants and operators, with examples of type juggling and string interpolation.
  3. PHP Conditions and LoopsLearn PHP if/else, switch, match, for, while and foreach loops with examples, and how to control loops with break and…
  4. PHP Functions and ArraysLearn PHP functions with parameters and return types, indexed and associative arrays, multidimensional arrays and useful array functions.
  5. Handling Forms in PHP: GET, POST and ValidationLearn how PHP receives form data with $_GET and $_POST, validate and sanitise input, and protect output with htmlspecialchars.
  6. PHP Sessions and CookiesLearn how PHP sessions and cookies work, build a simple login flow, and follow secure session practices such as regenerating…
  7. PHP and MySQL with PDO: CRUD and SecurityConnect PHP to MySQL using PDO, run create, read, update and delete queries with prepared statements, and prevent SQL injection.

Other courses