PHP Tutorial
Learn modern PHP 8.5 from your first echo to OOP, forms, sessions, PDO databases, security and real projects. 147 lessons with PHP that runs in your browser, quizzes and projects.
Start learning →
of lessons completed
Getting Started
- Getting Started with PHP Meet PHP, the language behind a huge share of the web. Learn what it is, where it runs, what it powers, and write and run your first PHP 8.5 scripts right in your browser.
- PHP Careers, Companies and PHP Compared with Other Languages Learn what PHP developers do, where PHP is used, how PHP compares with Python, Node.js and ASP.NET, and how PEAR became Composer - a practical map of the PHP ecosystem and career paths.
- How PHP Works Follow a web request from the browser through nginx and PHP-FPM and back, learn how PHP compiles code to opcodes, what OPcache and JIT do, and how to install PHP locally.
- PHP Syntax Learn PHP's basic syntax - opening and closing tags, when to omit ?>, statements and semicolons, blocks, case sensitivity, and mixing PHP with HTML using the short echo tag.
- Comments Learn every kind of PHP comment - single-line // and #, multi-line /* */, and DocBlocks that IDEs and static analyzers read - plus the traps with ?> and #[ in PHP 8.
- Output: echo, print, printf Learn every way to produce output in PHP - echo vs print, printf and sprintf formats, number_format, print_r, var_dump and var_export for debugging, and heredoc blocks.
- Variables Learn how PHP variables work - naming rules, assignment and copying, dynamic typing, isset, unset and empty, undefined variable warnings, references and variable variables.
- Constants Learn PHP constants - const versus define(), naming rules, array constants, class constants, magic constants like __LINE__ and __DIR__, and predefined ones like PHP_EOL and PHP_INT_MAX.
Data Types
- Data Types Get to know every PHP data type - bool, int, float, string, array, object, callable, null and resources - and check types with gettype, get_debug_type, is_* and var_dump.
- Strings Learn PHP strings - single vs double quotes, escape sequences, variable interpolation with braces, heredoc and nowdoc, string bytes and concatenation.
- Integers and Floats Learn PHP numbers - int size and overflow, hex, octal and binary literals, 1_000_000 separators, float precision, intdiv, fdiv, modulo and numeric strings.
- Booleans and null Learn PHP booleans and null - true and false, the complete truthy and falsy table, the "0" string trap, null and unset variables, ?? and nullable types.
- Type Juggling and Casting Learn how PHP converts types automatically, how to cast with (int), (string) and (bool), the PHP 8 comparison changes, and what declare(strict_types=1) does.
- Math Functions Learn PHP math functions - abs, round with PHP 8.4 rounding modes, floor, ceil, min, max, powers, random_int, number_format and bcmath for exact money math.
Operators
- Arithmetic and Assignment Operators Learn PHP arithmetic operators (+ - * / % **), precedence, compound assignment like += and .=, increment and decrement, and the new string increment rules.
- Comparison Operators Learn PHP comparison operators - == vs ===, != and !==, less and greater than, the spaceship operator, comparing strings and arrays, and the PHP 8 rules.
- Logical Operators Learn PHP logical operators - && (and), || (or), ! (not), xor, short-circuit evaluation, De Morgan's laws and the and/or precedence trap in assignments.
- Null Coalescing, Ternary and Nullsafe Operators Learn PHP's conditional operators - the ternary ?:, the short ternary, null coalescing ?? and ??=, and the nullsafe ?-> operator, plus the precedence traps to avoid.
- Bitwise, String, Array and Pipe Operators Learn PHP's remaining operators - bitwise flags, array union and comparison, instanceof, why to avoid @, the PHP 8.5 pipe operator |> and the full precedence table.
Control Flow
- if, elseif and else Learn PHP if, elseif and else - how conditions are evaluated, chains of checks, nesting, the alternative syntax for HTML templates, and the classic if-statement mistakes.
- switch and match Learn PHP switch and the PHP 8 match expression - fall-through and break, loose versus strict comparison, returning values, UnhandledMatchError and match(true) patterns.
- while, do-while and for Loops Learn PHP while, do-while and for loops - counters, reading input until it ends, nested loops, infinite-loop and off-by-one bugs, float counters and the alternative syntax.
- foreach Loops Learn the PHP foreach loop - values and keys, nested arrays, modifying elements, the by-reference dangling-reference bug, destructuring rows and iterating objects.
- break, continue and Loop Control Learn PHP break and continue - leaving loops early, skipping iterations, break 2 and continue 2 in nested loops and switch, why to avoid goto, and guard clauses.
Functions
- Functions Learn how to write PHP functions - defining and calling them, parameters, return values, naming rules, calling before the definition, conditional functions and function_exists.
- Parameters and Arguments Learn PHP function parameters - default values, pass by reference, named arguments, variadic ...$args, argument unpacking and the optional-before-required rule.
- Type Declarations Learn PHP type declarations for parameters and return values - scalar, nullable, union, intersection and DNF types, mixed, void, never, static and strict_types.
- Variable Scope Understand PHP variable scope - why functions can't see outside variables, the global keyword and $GLOBALS, static variables that remember values, and why globals hurt.
- Anonymous Functions and Closures Learn PHP anonymous functions and closures - capturing variables with use, by-reference capture, arrow functions fn, callables, and first-class callable syntax strlen(...).
- Recursion Learn recursion in PHP - base cases, factorial and power examples, walking nested arrays and folder trees, recursion depth and memory, memoization and iterative alternatives.
- Using Built-in Functions Learn to use PHP's built-in functions - read manual signatures, know the function families, pass callbacks, handle false returns, avoid deprecated functions and use NoDiscard.
- Closure Binding and Scope Learn how PHP closures are bound to $this and a class scope - Closure::bind, bindTo, call, fromCallable, static closures, callable strings and common pitfalls.
Strings in Depth
- String Functions A practical guide to PHP string functions - strlen, str_contains, strpos, substr, str_replace, trim, case changes, str_pad, str_repeat, strrev, wordwrap and nl2br.
- Comparing Strings - Equality, Similarity and Sounds-Like Compare PHP strings by order, natural order, edit distance and pronunciation with strcmp, strnatcmp, similar_text, levenshtein, soundex and metaphone, plus a "did you mean" example.
- Escaping and Encoding Helper Functions A tour of PHP's smaller string helpers - htmlentities, html_entity_decode, addcslashes, quotemeta, chunk_split, crc32, quoted_printable, strspn, count_chars and str_rot13.
- Unicode and Multibyte Strings Handle Unicode text correctly in PHP - bytes vs characters, how UTF-8 works, mb_strlen, mb_substr, mb_strtoupper, mb_str_pad (8.3), mb_trim (8.4) and grapheme pitfalls.
- Formatting Strings Format text in PHP with printf and sprintf - width, padding, precision and argument positions - plus number_format, str_pad tables, implode, explode and vsprintf.
- Regular Expressions Learn PCRE regular expressions in PHP - preg_match, preg_match_all, preg_replace, callbacks, preg_split, named groups, flags, preg_quote and how to avoid ReDoS.
Arrays
- Arrays Learn PHP arrays from scratch - the [] syntax, indexes, adding and removing elements, count, print_r and var_dump, copying, and why every PHP array is an ordered map.
- Associative Arrays Use PHP associative arrays as dictionaries and records - string keys, key casting rules, isset versus array_key_exists, looping over keys and values, and counting with ??=.
- Multidimensional Arrays Work with arrays of arrays in PHP - tables of records, grids and matrices, deep access and updates, nested loops, array_column, indexing by ID and safe lookups.
- Array Functions A practical tour of PHP array functions - push, pop, shift, array_merge versus +, slice and splice, strict in_array and array_search, unique, flip, fill, range and more.
- Sorting Arrays Sort PHP arrays by value or key, ascending or descending, with sort, asort, ksort and their reverse forms, custom usort comparisons with <=>, multi-key and natural sorting.
- array_map, array_filter and array_reduce Transform, filter and summarize PHP arrays with callbacks - array_map, array_filter, array_reduce, array_walk, PHP 8.4 array_find/any/all, 8.5 array_first and the pipe.
- Destructuring and Spread Unpack PHP arrays with [$a, $b] = ..., keyed and nested destructuring, swaps and foreach, then merge arrays and arguments with the ... spread operator.
Object-Oriented PHP
- Object-Oriented Programming in PHP Learn why PHP uses objects, how a class differs from an object, and how to write a first class with properties, methods, new and $this.
- Classes, Properties and Methods Write PHP classes with typed properties, methods, public/protected/private visibility, uninitialized properties, dynamic property rules and clone.
- Constructors and Destructors Initialize PHP objects with __construct, constructor property promotion, named arguments, new in initializers, __destruct and new without parentheses.
- Inheritance Learn PHP inheritance: extends, overriding, parent::, protected members, constructor inheritance, final, signature rules, Liskov and the Override attribute.
- Abstract Classes and Interfaces Learn PHP abstract classes and methods, interfaces, implementing several interfaces, interface constants, Stringable, Countable and how to choose.
- Traits Share methods between unrelated PHP classes with traits: use, precedence, insteadof and as, abstract and static members, trait constants and when to avoid them.
- Static Properties and Methods Learn PHP static properties and methods, self:: vs static:: and late static binding, named constructors, static factories and the risks of static state.
- Class Constants and Enums Learn PHP class constants, typed and final constants, and enums - pure and backed cases, methods, interfaces, cases(), from() and tryFrom() with examples.
- Readonly Properties and Immutable Objects Learn PHP readonly properties and readonly classes, how to build immutable value objects with withers, clone and the PHP 8.5 clone-with syntax.
- Property Hooks and Asymmetric Visibility Learn PHP 8.4 property hooks - get and set hooks, virtual properties, validation - plus asymmetric visibility like public private(set) and properties in interfaces.
- Magic Methods Learn PHP magic methods - __toString, __get and __set, __isset, __call and __callStatic, __invoke, __clone, __serialize - and when magic hurts readability.
- Namespaces Learn PHP namespaces - declaring them, importing classes, functions and constants with use, aliases, group use, the global fallback rules and PSR-4 folders.
- Autoloading and Composer Learn how PHP autoloading works with spl_autoload_register and PSR-4, then use Composer - composer.json, require, autoload, versions, the lock file and Packagist.
- Comparing, Copying and Serializing Objects Learn how PHP compares objects with == and ===, shallow versus deep copies with clone and __clone, the dangers of unserialize, and JSON with JsonSerializable.
- OOP Design Principles Learn object-oriented design in PHP - the SOLID principles with small examples, composition over inheritance, dependency injection and interfaces for testability.
Errors and Exceptions
- Errors, Warnings and Notices Learn how PHP reports problems - error levels, warnings vs notices vs deprecations, error_reporting, display_errors vs log_errors, the @ operator and set_error_handler.
- Exceptions Learn PHP exceptions - throw, try/catch/finally, catching several types, catch without a variable, throw expressions and the Throwable, Error and Exception hierarchy.
- Custom Exceptions and Error Handling Strategy Create your own PHP exception classes, chain exceptions with previous, turn warnings into ErrorException, add a global handler and decide what to catch where.
- Debugging PHP Learn to debug PHP - inspect values with var_dump, print_r and var_export, read stack traces, use debug_backtrace and error logs, set up Xdebug and use assert().
Working with Files
- Reading and Writing Files Read and write files in PHP - file_get_contents, file_put_contents, file(), fopen modes, fgets and fwrite, appending, locking with LOCK_EX, error handling and __DIR__ paths.
- Files and Directories Manage files and folders in PHP - mkdir, scandir, glob, is_file and is_dir, copy, rename, unlink, file sizes and dates, realpath, temp files and recursive iteration.
- CSV Files Read and write CSV files in PHP with fgetcsv, fputcsv and str_getcsv - turn headers into associative arrays, set the escape parameter and handle Excel, BOMs and semicolons.
- JSON Work with JSON in PHP - json_encode and json_decode, arrays vs objects, JSON_PRETTY_PRINT and JSON_THROW_ON_ERROR, json_validate in PHP 8.3 and JsonSerializable.
- XML Read, query and build XML in PHP with SimpleXML, DOMDocument, XPath and XMLWriter, parse HTML with PHP 8.4's Dom\HTMLDocument, and handle bad XML safely.
- Streams and Wrappers Learn how PHP streams work - php://stdin, php://memory and php://temp, data:// URLs, gzip with compress.zlib://, stream filters, contexts and custom filters.
- Working with Images: GD Create, inspect, resize, crop and watermark images in PHP with the GD extension, keep transparency, and save JPEG, PNG, WebP or AVIF at the right quality.
PHP and the Web
- PHP and HTML Templates Embed PHP in HTML the clean way - short echo tags, alternative syntax, escaping with htmlspecialchars, template files with output buffering and layouts.
- Superglobals Understand PHP superglobals - $_GET, $_POST, $_SERVER, $_FILES, $_COOKIE, $_SESSION, $_ENV and why to avoid $_REQUEST - with simulated web requests you can run.
- Handling Forms Handle HTML forms in PHP - GET vs POST, reading fields safely, filter_var and filter_input, checkboxes and selects, sticky forms and the POST-redirect-GET pattern.
- Form Validation Validate form input in PHP - required fields, lengths, emails, numbers and dates, collecting errors per field, showing messages, and why server-side checks are a must.
- File Uploads Handle file uploads in PHP safely - multipart forms, the $_FILES array, UPLOAD_ERR codes, size and type checks with finfo, safe file names and storage outside the web root.
- Cookies Set, read and delete cookies in PHP with setcookie - expires, path, domain, secure, httponly and samesite - plus signed cookies and what never to store in one.
- Sessions Learn how PHP sessions work: session_start, $_SESSION, session IDs and cookies, logging in and out safely, flash messages, locking and session security.
- HTTP Headers, Status Codes and Redirects Control PHP's HTTP response: header(), http_response_code(), Location redirects, content types, downloads, caching headers and the headers already sent error.
- Front Controllers and Routing Send every request through one index.php: parse the URL path, build a tiny PHP router with closures and route parameters, handle 404 and 405, and set up pretty URLs.
- Building a JSON API Build a JSON API in plain PHP: send JSON responses, read request bodies from php://input, map HTTP methods to CRUD, choose status codes and call other APIs with curl.
- API Versioning and OpenAPI Documents Version a PHP REST API without breaking clients - URL, header and date strategies, deprecation headers, and describing endpoints with an OpenAPI 3.1 document.
- Middleware and Request Pipelines Learn how PHP middleware wraps a request handler in layers, the idea behind PSR-15, and build your own pipeline for auth, logging and CORS-style headers.
- AJAX, fetch and Progressive Enhancement Make PHP pages update without a reload: write JSON and HTML-fragment endpoints, call them with fetch, and add the htmx idea on top of working HTML forms.
- Templating: Twig and Blade Concepts Understand how Twig and Blade work: automatic escaping, filters, loops, layouts and compiled templates, then build a small template engine in PHP yourself.
- Parsing HTML and Scraping with DOMDocument and XPath Parse HTML in PHP with DOMDocument, DOMXPath and PHP 8.4's Dom\HTMLDocument - extract links, images and prices, resolve URLs, fetch pages with cURL and scrape politely.
Databases
- PHP and Databases How PHP works with databases: relational databases, MySQL, PostgreSQL and SQLite, mysqli vs PDO, why PDO is the standard, DSNs and connecting safely.
- PDO Basics: Connecting and Querying Learn PDO step by step: DSNs and connection options, exec and query, fetch, fetchAll and fetchColumn, fetch modes, error modes and PHP 8.4's PDO::connect.
- Prepared Statements and SQL Injection See SQL injection happen in a safe demo, then stop it with PDO prepared statements: prepare and execute, named and positional placeholders, binding types, IN lists and LIKE.
- CRUD with PDO Build complete CRUD with PHP and PDO: insert rows and get lastInsertId, select one or many, update and delete with rowCount, and wrap it all in a repository class.
- Transactions Learn database transactions in PHP with PDO - beginTransaction, commit and rollBack, the try/catch pattern, a money transfer, savepoints, speed and isolation.
- Using MySQLi Learn the PHP MySQLi extension - connecting, queries, prepared statements with bind_param and execute_query, errors, transactions, and how it compares to PDO.
- Pagination, Search and Database Patterns Learn practical PDO patterns - LIMIT/OFFSET and keyset pagination, safe LIKE search, sorting by whitelisted columns, avoiding N+1 queries, and migrations.
- ORM Concepts: Active Record vs Data Mapper Understand what an ORM does, compare the Active Record and Data Mapper patterns by building tiny versions in PHP, and learn to spot and fix the N+1 query problem.
Security
- Web Security Basics Learn how PHP web apps get attacked and how to think about defense - common threats, trust boundaries, never trusting input, allowlists and defense in depth.
- Preventing XSS Learn how cross-site scripting works and how to stop it in PHP - htmlspecialchars with ENT_QUOTES, escaping for attributes, URLs, JavaScript and CSS, plus CSP.
- Preventing CSRF Learn how cross-site request forgery works and how to stop it in PHP - random tokens with random_bytes, hash_equals checks, SameSite cookies and Origin headers.
- Password Hashing Learn to store passwords safely in PHP with password_hash, password_verify and password_needs_rehash, bcrypt vs Argon2id, and why md5 and sha1 are never enough.
- Hashing, Encryption and Random Numbers Practical cryptography in PHP - hash and hash_hmac, secure random numbers, the Random\Randomizer API, encryption with sodium and OpenSSL, and what not to build.
- Secure Coding Checklist Close the PHP security holes beyond XSS and SQL injection - file inclusion, path traversal, command injection, unserialize, open redirects and production config.
- Tokens, JWT and OAuth Flows Understand signed tokens in PHP - build and verify HS256 JWTs with hash_hmac, handle expiry and algorithm pinning, and follow the OAuth 2 authorization code flow with PKCE.
- Two-Factor Auth and Passkeys Implement TOTP two-factor authentication in PHP with hash_hmac and Base32, handle recovery codes and rate limits, and understand how passkeys and WebAuthn work.
Advanced PHP
- Generators Learn PHP generators - how yield pauses a function, keys, lazy pipelines for large files, yield from, sending values in, return values and the memory savings.
- Iterators and the SPL Make your PHP objects work with foreach, count() and [] using Iterator, IteratorAggregate, Countable and ArrayAccess, and use the SPL stacks, queues and heaps.
- Attributes Learn PHP 8 attributes - the #[...] syntax, built-ins like Override, Deprecated, NoDiscard and SensitiveParameter, and custom attributes read with Reflection.
- Reflection Use PHP's Reflection API to inspect classes, methods, properties and types at run time, call private code in tests, and build a tiny autowiring DI container.
- Fibers and Asynchronous PHP Learn PHP 8.1 Fibers - start, suspend and resume, passing values and exceptions, a tiny scheduler with async sleep, and how ReactPHP, Amp and Revolt use them.
- Dates and Times Work with dates in PHP - date() and timestamps, strtotime, DateTimeImmutable, formats, DateInterval, DatePeriod, timezones, comparisons and DST pitfalls.
- Calendar and Julian Day Functions Use PHP's calendar extension - cal_days_in_month, easter_date, gregoriantojd, jddayofweek and jdmonthname - and learn the DateTime equivalents for when the extension is missing.
- The PHP Type System in Depth Master PHP's type system - union, intersection and DNF types, never and static, covariance and contravariance, and generics with @template for PHPStan and Psalm.
- Performance and OPcache Make PHP fast the right way - measure with hrtime and memory_get_usage, fix common slow patterns, cache results, and configure OPcache, preloading and JIT.
- Command-Line PHP Write command-line tools in PHP - read arguments with $argv and getopt, use STDIN, STDOUT and STDERR, return exit codes, prompt for input and handle signals.
- Internationalization and Localization Build multilingual PHP apps - message catalogs, gettext-style keys, plural rules, locale-aware number, currency and date formatting, fallbacks and the intl extension.
- Sockets and Network Streams Learn PHP network programming with streams - stream_socket_server, stream_socket_client, accept, stream_socket_pair, timeouts, non-blocking mode and stream_select.
- Dependency Injection and Containers Learn constructor injection in PHP, why it beats hidden dependencies, and how to build a small PSR-11 style container with bind, get and autowiring.
- Events and Listeners Learn the observer pattern in PHP and build a PSR-14 style event dispatcher with listeners, priorities, stoppable events and subscribers.
- Logging with PSR-3 Learn PHP logging with the PSR-3 interface - log levels, context placeholders, writing your own logger with handlers, and rotating log files by size.
- Caching in PHP Learn caching in PHP - in-memory and file caches with TTL, cache-aside, APCu and OPcache, HTTP cache headers with ETag, and how to invalidate safely.
Modern PHP and Ecosystem
- What's New in PHP 8.0 to 8.5 A tour of every PHP 8 release - match, enums, readonly, property hooks, the pipe operator, clone with and more - with runnable examples, deprecations and upgrade tips.
- Coding Standards and PSRs Write PHP that looks professional - PSR-1, PSR-12 and PER Coding Style rules, PSR-4 autoloading, the PSR-3/7/11/15 interfaces, and fixers like Pint and PHP-CS-Fixer.
- Testing PHP Code Learn to test PHP code - assertions, a mini test runner you can run, PHPUnit and Pest syntax, data providers, test doubles, database tests and static analysis.
- Design Patterns in PHP Learn the design patterns PHP developers really use - factory, strategy, observer, decorator, adapter, repository and DI containers - and why to avoid singletons.
- PHP Frameworks and CMSs What PHP frameworks give you, how MVC works (with a tiny runnable MVC app), and how Laravel, Symfony, Slim, WordPress and Drupal compare so you can choose well.
- Deploying PHP Applications Take PHP to production - safe php.ini settings, PHP-FPM and nginx, environment variables, Composer --no-dev, OPcache, logs, health checks and zero-downtime deploys.
- Queues and Background Jobs Learn how PHP queues move slow work out of the request - job serialization, workers, retries with backoff, failed jobs and idempotent job design.
- Long-Running PHP: Workers, Swoole and RoadRunner Learn how persistent PHP workers differ from PHP-FPM, why memory leaks and shared state bite, and how event loops, Swoole and RoadRunner keep an app alive.
- Static Analysis and Code Quality Find PHP bugs before running the code: how static analyzers like PHPStan and Psalm work, what their levels mean, how to annotate types and enforce style.
Projects
- Project: To-Do List Build a PHP to-do list in four stages - an array of tasks, form commands from $_POST, escaped HTML, a PDO SQLite repository and a front controller.
- Project: Contact Form with Validation Build a secure PHP contact form in four stages - sticky escaped fields, server-side validation, CSRF tokens and a honeypot, then sending the message by email.
- Project: Mini Blog with PDO Build a mini blog in PHP in four stages - a PDO SQLite schema with slugs, a tiny router for list and post pages, pagination, and escaped reader comments.
- Project: Login System Build a secure PHP login system in four stages - registration with password_hash, session login, rate-limited attempts and safe remember-me tokens.
- Project: REST API Build a JSON REST API for books in PHP in four stages - routing, PDO with pagination, validated create/update/delete with correct status codes, auth and errors.
- Project: Shopping Cart Build a PHP shopping cart in four stages - money as integer cents, a session cart, coupons with enums and match, tax with bcmath and a transactional checkout.
- Project: Group Chat with Polling Build a PHP group chat in five stages - messages in SQLite, JSON endpoints, polling with a since-id, safe escaping, rate limiting and a Server-Sent Events stream.
- Project: URL Shortener Build a URL shortener in PHP in four stages - validate and normalize links, generate unique codes, store them with PDO and SQLite, then route requests and redirect.
- Project: File Downloader Build a secure PHP file downloader in four stages - safe file lookup, Content-Disposition headers, streaming large files in chunks, and partial downloads with HTTP Range requests.
- Project: Public API Dashboard Build a statistics dashboard from a public JSON API in PHP - fetch with cURL, handle errors, cache responses with a TTL, aggregate the data and render an HTML table and an SVG bar chart.
- Project: Upload Manager with Database Records Build a PHP upload manager in four stages - normalize multiple uploads, validate size and real MIME type, store files and metadata in MySQL with PDO, then list, download and delete them.
Practice and Review
- PHP Cheat Sheet A dense one-page PHP 8.5 reference: syntax, types, strings, arrays, functions, OOP, enums, errors, files, JSON, PDO, security and new features by version.
- PHP Programs: 50 Classic Examples 50 classic PHP programs with output: primes, factorial, Fibonacci, palindromes, Roman numerals, word counts, sorting, matrices, dates, CSV, JSON and classes.
- PHP Array Programs II: 15 More Classic Examples 15 more PHP array programs with output - second most frequent, missing numbers, closest value, sorting 0s 1s 2s, rotation check, triplets, median, leaderboard, XML and standard deviation.
- PHP String Programs II: 12 More Classic Examples 12 more PHP string programs with output - permutations, minimum rotation, last word, cleaning special characters, truncating, text between markers, unique IDs, string to bool and == vs strcmp.
- PHP Date and Function Programs: 11 Practical Examples 11 PHP programs with output - weekdays between dates, last day of month, add 24 hours, sort dates, format phone numbers, zero-pad, file extensions, usernames and pass by reference.
- PHP JSON and File System Programs: 8 Practical Examples 8 PHP programs with output - JSON to CSV, XML to JSON, arrays to JavaScript, receiving a JSON POST, creating folders, deleting files, listing a tree and logging errors to a file.
- Practical PHP Snippets: 7 Everyday Recipes 7 practical PHP recipes with output - detect search bots, read multiple checkboxes, pass form values between pages, find where a function is defined, hide notices, short echo tags and clean URLs.
- PHP Practice Exercises 30 graded PHP exercises with solutions on loops, functions, strings, regex, arrays, sorting, classes, enums, exceptions, JSON, CSV, forms and PDO. Run PHP online.
- PHP Interview Questions 49 PHP interview questions with clear answers plus 5 code-reading puzzles, from types and arrays to OOP, enums, exceptions, security, OPcache and Composer.