PHP · Interactive Curriculum
Learn PHP Online
From Scripts to APIs
A free modern PHP 8 course with browser practice for functions, arrays, OOP, forms, databases, Composer, caching, and REST API best practices.
1<?php2echo "Hello, PHP!\n";Why Learn PHP?
Discover the benefits of learning PHP for web development.
Web-First Design
Built specifically for web development with excellent server-side rendering.
All PHP Lessons
Browse the full curriculum. Each lesson has a readable page you can link to and share.
Introduction to PHP
Start learning PHP from scratch. Understand why PHP powers millions of websites and write your first server-side script.
Variables and Data Types
Learn PHP variables and data types including strings, integers, floats, booleans, and type casting for type-safe PHP development.
Functions
Learn PHP functions with typed parameters, return types, closures, and arrow functions. Build reusable code blocks for any project.
Control Flow
Learn PHP control flow with if/else, switch, match expressions, and loops. Build programs that make decisions and iterate over data.
Arrays and Objects
Master PHP arrays and objects for organizing complex data. Learn indexed arrays, associative arrays, array_map, filter, and reduce.
OOP and Classes
Master PHP object-oriented programming with classes, inheritance, abstract classes, interfaces, and constructor promotion.
Error Handling
Learn PHP error handling with try/catch/finally, custom exception classes, and error reporting for production-ready applications.
Working with Databases
Connect to databases with PHP PDO. Learn CRUD operations, prepared statements, parameter binding, and transactions for safe data access.
File Handling
Learn PHP file handling to read, write, and manage files and directories. Process CSV uploads, handle file streams, and manage paths.
Sessions and Cookies
Manage user state with PHP sessions and cookies. Build login systems, shopping carts, and flash messages across HTTP requests.
Laravel Basics
Get started with Laravel, PHP's most popular framework. Learn routing, controllers, Blade templates, and Eloquent ORM basics.
API Development
Build RESTful APIs with PHP using proper HTTP methods, JSON responses, request routing, and input validation patterns.
Authentication and Security
Implement secure PHP authentication with password hashing, CSRF protection, XSS prevention, and SQL injection defense.
Deployment
Deploy PHP applications to production. Learn Composer autoloading, environment config, PHP-FPM, nginx, error logging, and opcache.
Capstone Project: Blog System
Build a complete blog system with PHP combining authentication, CRUD operations, SQLite database, templates, and a REST API.
String Manipulation
Master PHP string functions for searching, formatting, transforming, and parsing text data in web applications.
PHP 8 Features
Explore PHP 8 features including match expressions, named arguments, union types, nullsafe operator, and constructor promotion.
Composer And Packages
Learn Composer, PHP's dependency manager. Install packages, manage versions, configure autoloading, and structure modern PHP projects.
Testing With Phpunit
Learn PHP testing with PHPUnit. Write test classes, use assertions, data providers, and mocking for reliable, maintainable code.
Design Patterns
Learn classic design patterns in PHP including Singleton, Factory, Observer, and Strategy with practical, real-world examples.
Form Processing
Learn safe PHP form processing. Read input data, sanitize and validate user submissions, and return meaningful error messages.
Templating And Views
Separate PHP logic from HTML with templating patterns. Build reusable layouts, partials, and a minimal template engine from scratch.
Queues And Jobs
Implement background job queues in PHP with job interfaces, workers, retry logic, and priority scheduling for async task processing.
Caching And Performance
Learn PHP caching strategies from in-memory arrays to file-based caches. Master TTL expiration, cache invalidation, and profiling.
Rest Api Best Practices
Design production-grade REST APIs in PHP with consistent response structures, proper HTTP semantics, error handling, and versioning.
Frequently Asked Questions
- Can I learn PHP here for free?
- Yes. LearningPHP.org is free, and between the lessons and the browser playground you can work through PHP 8 syntax, arrays, OOP, forms, databases, APIs, and the patterns used in modern web development.
- Do I need XAMPP or a local server first?
- No. Start by running PHP straight in the online playground, and only set up a local server or framework once you actually want to build something bigger.
- Is this modern PHP or the old stuff?
- Modern PHP. The course is built around PHP 8+ and the safer patterns that come with it, covering OOP, Composer, testing, APIs, and practical web development rather than habits from a decade ago.
- Where should I go after the PHP basics?
- Once variables and functions are second nature, spend your time on arrays, classes, error handling, databases, forms, authentication, Composer, and building REST APIs.