PHP Reference

The PHP Cheat Sheet Every Backend Dev Keeps Open

Every string function, array function, and OOP pattern you reach for — including PHP 8+ features. Stop wasting time looking up whether str_replace takes the search or replace argument first. Keep the complete reference within arm's reach.

$9
One-time payment · Instant PDF download
📄 PDF format ⚡ Instant download 🖨️ Print-ready ♾️ Keep forever
php-cheat-sheet.pdf
STRING FUNCTIONS
str_replace(s,r,sub)Replace string
strlen($str)String length
str_contains($s,$n)PHP 8+: contains
ARRAY FUNCTIONS
array_map(fn, $arr)Transform array
array_filter($arr,fn)Filter elements
array_merge($a,$b)Merge arrays
PHP 8+ FEATURES
match($val){...}Match expression
fn($x) => $x * 2Arrow function
$obj?->method()Null-safe operator

What's inside the PHP Cheat Sheet

8 sections covering everything from basic PHP variables to modern PHP 8+ features — all the functions you actually reach for.

🔤

Variables & Data Types

PHP's type system, casting, and the comparison operators that catch every developer out.

  • Scalar types (string, int, float, bool)
  • Type casting and gettype()
  • == vs === comparison
  • Variable variables and references
📝

String Functions (50+ most used)

Every string function with correct argument order — the reference every PHP dev needs.

  • str_replace, str_contains, substr
  • strlen, strtolower, strtoupper, trim
  • explode, implode, sprintf
  • preg_match, preg_replace (regex)
📋

Array Functions (50+ most used)

PHP arrays are the most powerful data structure in the language — master every function.

  • array_map, array_filter, array_reduce
  • array_push, array_pop, array_shift
  • array_merge, array_unique, array_flip
  • usort, uasort and custom sorting
📅

Date & Time Functions

Work with dates, timestamps and formatting without memorising the format characters.

  • date() and date_format()
  • strtotime() and mktime()
  • DateTime class and DateInterval
  • Date format character reference
📁

File System Operations

Read, write, check and manipulate files and directories in PHP.

  • file_get_contents, file_put_contents
  • fopen, fread, fwrite, fclose
  • file_exists, is_file, is_dir
  • mkdir, rmdir, scandir, unlink
🗄️

PDO Database Operations

Secure database access with PDO — prepared statements and parameter binding.

  • PDO connection and DSN format
  • prepare() and execute()
  • fetch() and fetchAll() modes
  • Transactions with PDO
🏗️

OOP (classes/interfaces/traits)

Modern PHP object-oriented patterns from class definition to dependency injection.

  • Class, abstract class, interface
  • Traits and multiple inheritance
  • Constructor property promotion (PHP 8)
  • Static methods and late static binding
🚀

PHP 8+ Modern Features

Every PHP 8.x feature that makes your code cleaner, faster and more expressive.

  • match expression vs switch
  • Named arguments and fibers
  • Null-safe operator (?->)
  • Union types and enums (PHP 8.1)

Who this cheat sheet is for

  • Laravel and Symfony developers who need a plain PHP function reference alongside their framework docs
  • Backend developers who always forget which order string function arguments go in
  • Developers migrating legacy code to PHP 8+ and learning modern syntax
  • Freelancers building custom PHP applications without a full framework
  • WordPress developers writing custom plugins and theme functions

What you get

📄
PDF file
High-resolution, print-ready PDF. Works on any device.
Instant access
Download immediately after purchase via Gumroad.
🖨️
Print-optimised
Designed to look perfect on A4 or US Letter paper.
♾️
Yours forever
One payment. No subscription. Download again any time.
Instant Download
$9
One-time payment · PDF · No subscription

Get the PHP Cheat Sheet now

Stop guessing argument order. Keep the complete PHP reference within arm's reach.

Buy on Gumroad →