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
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
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
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
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
"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
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
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!
AddedBytes.com is the online playground of 
187 Comments
An italian translation can be found on my site here:
http://www.dapuzz.com/script/index.php?action=schema_php
with the images just taken here and many links to this article. If somethigs is wrong contact me: mail@dapuzz.com
Thanks!
If you (or anyone else) have any suggestions for improvements, please do volunteer them.
It's things like this that make me question why kids can't use cheatsheets in class.
thx man !!!!
Any chance of seeing it in PDF or PS format?
I'd like to get it in print quality PDF if possible too.
You meant like this?
http://loadaveragezero.com/app/drx/Programming/Languages/PHP#IloveJD:cheatsheet
Nice work Dave. ;-)
Or did someone mention that allready? :)
It would make for a better printout and even better if you create it from Illustrator it can be imported again by other making it easier to get transalted versions as well.
ps: can u drop me a mesaage on my blog or something when you have a PDF version? would be great.
As others have said, it'd be great to make a print-quality PDF out of this.
Also, the oft-forgotten information for one person may not match that of another; it'd be nice to customize this for our own, personal brain damage.
In any case, thanks for the resource!
a+?
a*?
andig: The "+" for one or more and "*" for zero or more are both listed in the regex section. Is that what you meant?
Why do you want a PDF version? PNG is the best way to do it, for PDF you need a PDF reader, for PNG all you need an up do date browser...
But it would be a lot better if it were not an image* but an actual HTML page with a proper print stylesheet: that way it wouldn't print so bad on low-resolution printers. The fuzzy anti-aliased text looks really bad now and some small details like superscript for notes are not discernable at all.
Text-as-image is never a good idea, but a really bad choice if it's intended to be printed.
Thanks for this!
Another handy function order (which I'm always forgetting anyway) would be substr, and maybe ucfirst and and ucwords in the string functions list.
I was expecting to have a handful of sheets to print out - not one single handy sheet of A4 - as this is. :)
Anyway, thanks for the time with it. :)
find out soon an ukrainian translation on php.com.ua !
Anatolij Dobrosynets
http://www.sitepoint.com/books/xml1/poster.php
$10 US. lol
>> a*?
> andig: The "+" for one or more and
> "*" for zero or more are both listed
> in the regex section. Is that what
> you meant?
No, he meant the use of the ? to make the + and * quantifiers ungreedy.
No, the ungreedy modifier is missing, as are lookahead and lookbehind assertions and so on. When creating the sheet, space was obviously at a premium so some items were cut from it. That included for the most part things that I felt were not likely to be looked up. People generally like to use a Regex aid when starting out, but by the time they understand greediness and assertions, they've usually been using regular expressions long enough that they don't need to look up things like that any more. Hopefully.
By the way I am not good at these kind of print things. My question is that which format wil do me good for printing, PDF or PNG ?
Jeremy Child
Australia
( Still, PHP sux :P )
Best wishes & keep up the great work,
Tobias Hoffmann
The pdf of css Syntax ist very good.
The File ist a nice help for my next Projekt.
Sorry my EN is ;-(
@ many people have trouble with regular expressions!
and i also.
we all drink jacky in our travel agency after work,
for football we drink all the day so work is fun.
if you travel over us, we serve jacky for english people
i also got trouble with regular epressions;/ hehe
Jennifer
Two function that would be great to have on the list are intval and strval.
Cheers.
David
And CSS - I can never work that thing out, but that's a different topic.
but i still love it
wonderfull idea /Job ,Really thank u especillay for your valuable work!
Take care!
beautifull Side and nice comments.
Jack Daniels is the best Whisky of the time.
Dean
It's help me.
Thanks!
Now I can easily access all the functions I need at the right time, I'm planning to make a poster of it, so that I can hang in the wall.
I also really think a PDF version would be nice.
Thanks,
Florian
Thank you very much!
Gracias.
www.macroweb.ws
programacion web
The PHP cheat is really heplful !!!!
THis is great! However, the pdf contains only 1 page?! (function list) where can I get the others.
Thanks
gitti from germany
It's a very interesting Blog and simple answer of many questions.
super site, keep on doing, kind regards from germany,
Thomas
I even posted on my blog about your cheat sheets: http://oysblog.uni.cc/2007/08/31/cheat-sheets/
Greetings from Germany
Jess
It would be nice to find an spot for reserved $_SERVER[] indexes. I always go to php.net looking for that too. :)
Thanks again
thanks !!
Thanks!
Wolfgang
Alex from Moldova
Àlex from Catalonia!
Greets from Belgium!
Would you know of such a sheet for javascript as well? I seem to have my PHP matters bugfree, but do have some issues with JS.
R.,
Frank
Frank
Thank you VERY much!
Eternally grateful.
I will come back and check more from you.
best wishes
Stephan
Are there other PDFs to download
Thanks in advance
RLH
best wishes
Rosina
Rosina et al: Glad you like it :)
For those working on a Mac, there is an application called PHPfi (PHP Function Index) which takes PHP documentation in HTML format and provides an easy, searchable, local reference for PHP's functions. There is even a TextMate integration bundle if memory serves. (N.B. I have NOTHING to do with the development of PHPfi — just recommending it as a fantastic local resource for those looking for a more thorough reference).
but, how can I download the cheat sheet ??
Thanks
(^_^)
big big thanx
merci beacoup
terima kasih banyak
arigato
!!!!!!!!!!!!!
The File ist a nice help for my next Projekt
Best Regards Holz-Handel
cheers alex