Himanshu SharmaSoftware engineer
Let’s talk

Beginner to intermediate · 54 lessons

PHP for beginners

A free PHP course from your first script to forms, sessions, OOP, PDO and security. Short lessons with verified output, quizzes, a final project and an exam with a certificate.

Syllabus

Getting started

  1. What PHP is and how it works9 min
  2. Install PHP12 min
  3. Your first PHP script12 min
  4. PHP syntax, statements and comments11 min

The basics

  1. Variables11 min
  2. Data types and var_dump13 min
  3. Strings, quotes and interpolation13 min
  4. Integers, floats and maths13 min
  5. Constants10 min
  6. Operators13 min
  7. Comparisons, == versus === and type juggling13 min
  8. echo, print and printf12 min

Control flow

  1. if, elseif and else12 min
  2. switch and match11 min
  3. while and do-while loops11 min
  4. for and foreach loops12 min
  5. Ternary, null coalescing and nullsafe operators10 min

Functions

  1. Writing functions12 min
  2. Parameters, defaults, named arguments and types14 min
  3. Variable scope, global and static10 min
  4. Closures and arrow functions12 min
  5. include, require and splitting code into files11 min

Arrays

  1. Indexed and associative arrays13 min
  2. Multidimensional arrays12 min
  3. Common array functions14 min
  4. Sorting arrays12 min
  5. array_map, array_filter and array_reduce12 min

Strings, dates and patterns

  1. Searching, slicing and replacing text13 min
  2. Unicode text and the mb_ functions11 min
  3. Regular expressions with preg_ functions14 min
  4. Dates and times14 min

PHP on the web

  1. Mixing PHP and HTML13 min
  2. Handling forms with GET and POST14 min
  3. Validating and escaping form input14 min
  4. Superglobals, headers and redirects13 min
  5. Cookies11 min
  6. Sessions14 min
  7. File uploads14 min

Files, data and errors

  1. Reading and writing files13 min
  2. JSON: encoding and decoding data12 min
  3. Errors and exceptions14 min

Object-oriented PHP

  1. Classes and objects13 min
  2. Constructors, typed and readonly properties12 min
  3. Inheritance and method overriding12 min
  4. Interfaces and abstract classes13 min
  5. Traits10 min
  6. Static members and class constants11 min
  7. Enums12 min
  8. Namespaces, autoloading and Composer14 min

Databases and security

  1. Connecting to a database with PDO13 min
  2. CRUD with prepared statements14 min
  3. Storing passwords safely11 min
  4. Web security: XSS, CSRF and SQL injection15 min
  5. Project: a guestbook with a database25 min