Skip Navigation

Find cheat sheets for every topic, or make your own to share with your friends.

All Added Bytes cheat sheets are available free at Cheatography!

Visit Cheatography »

PHP Cheat Sheet (V1)

I'm fed up with having to visit php.net to look things up. This A4 cheat sheet is designed to sit by your desk and make your life easier.

There is a newer version of this cheat sheet!

The PHP cheat sheet is designed to be printed on an A4 sheet of paper and live by a developers desk, to make life a bit easier. A description of what is on the cheat sheet follows, or if you are impatient, you can go straight to the full size PHP cheat sheet.

Function List

Thumbnail highlighting function list. Probably the biggest problem with PHP is its inconsistency. Some function names use underscores, some don't. Some are of the form "verb object" and some are "object verb". Some use "2" instead of "to". The side sections of the cheat sheet list many of the most commonly used functions in PHP and are there to provide a quick reference to check function names.

SuperGlobals

Thumbnail highlighting superglobals list. In PHP, SuperGlobals are available at any point in a script, and allow access to data from the user and session date, as well as information about server settings and environmental data. This section contains a list of SuperGlobal variable names.

Date Formatting

Thumbnail highlighting date formatting. There are, as I'm sure you are aware, a huge number of options when it comes to date formatting, and there are few people who remember all of them. This section of the cheat sheet lists the various options, followed by a description, and an example where appropriate.

Regular Expression Syntax

Thumbnail highlighting regular expression syntax. Many people have trouble with regular expressions, and the first step to coming to grips with them is to become familiar with the various symbols used in regular expressions and their meaning. This section lists these symbols and describes their meaning.

PCRE Modifiers

Thumbnail highlighting PCRE modifiers. "PCRE" stands for "Perl Compatible Regular Expressions". In PHP, this refers to functions like "preg_replace" and "preg_split". The patterns used in these functions can have modifiers applied to them, and this section list those modifiers and what they do.

Function Argument Orders

Thumbnail highlighting function argument ordering. One of the other major inconsistencies in PHP is function argument ordering. Functions that are very very similar often completely opposite ordering of arguments. This section simply lists a few of the common ones people are sometimes confused by, or that people find easy to forget.

fopen() Modes

Thumbnail highlighting fopen modes. fopen() is a widely used function and has several modes in which it can operate, depending on whether you want to read or write to a file, and what you want to do with data already in that file. This section lists those modes and what each does.

Download

So now that you know what it does, please feel free to print out the PHP cheat sheet:

Please note: If you wish to link to the PHP cheat sheet from elsewhere, please link to this page so others find the description, rather than linking directly to the sheet.

And finally, if you like the cheat sheets, and want to say thanks, please consider buying me something from my Amazon Wishlist. Thankyou very much to those who have already hunted it down and sent me something nice - I'm very grateful!

Related Cheat Sheets

PHP (V2)

PHP Cheat Sheet (V2)

The second version of the PHP Cheat Sheet, a quick reference guide for PHP, with functions references, a regular expression syntax guide and a reference for PHP's date formating functions.

CSS (V2)

CSS Cheat Sheet (V2)

The second version of the CSS Cheat Sheet, a quick reference guide for CSS, listing selector syntax, properties, units and other useful bits of information.

HTML

HTML Cheat Sheet

HTML is the language of the web. It is the semantic support on which websites depend. This A4 reference lists the various tags available to the web designer, as well as a selection of useful character entities, attributes and events.

MySQL

MySQL Cheat Sheet

A quick reference guide for MySQL, including functions (both in MySQL and PHP), data types, and sample queries. Available in PDF and PNG formats.


comments powered by Disqus