\documentclass[10pt,a4paper]{article} % Packages \usepackage{fancyhdr} % For header and footer \usepackage{multicol} % Allows multicols in tables \usepackage{tabularx} % Intelligent column widths \usepackage{tabulary} % Used in header and footer \usepackage{hhline} % Border under tables \usepackage{graphicx} % For images \usepackage{xcolor} % For hex colours %\usepackage[utf8x]{inputenc} % For unicode character support \usepackage[T1]{fontenc} % Without this we get weird character replacements \usepackage{colortbl} % For coloured tables \usepackage{setspace} % For line height \usepackage{lastpage} % Needed for total page number \usepackage{seqsplit} % Splits long words. %\usepackage{opensans} % Can't make this work so far. Shame. Would be lovely. \usepackage[normalem]{ulem} % For underlining links % Most of the following are not required for the majority % of cheat sheets but are needed for some symbol support. \usepackage{amsmath} % Symbols \usepackage{MnSymbol} % Symbols \usepackage{wasysym} % Symbols %\usepackage[english,german,french,spanish,italian]{babel} % Languages % Document Info \author{Dave Child (DaveChild)} \pdfinfo{ /Title (php.pdf) /Creator (Cheatography) /Author (Dave Child (DaveChild)) /Subject (PHP Cheat Sheet) } % Lengths and widths \addtolength{\textwidth}{6cm} \addtolength{\textheight}{-1cm} \addtolength{\hoffset}{-3cm} \addtolength{\voffset}{-2cm} \setlength{\tabcolsep}{0.2cm} % Space between columns \setlength{\headsep}{-12pt} % Reduce space between header and content \setlength{\headheight}{85pt} % If less, LaTeX automatically increases it \renewcommand{\footrulewidth}{0pt} % Remove footer line \renewcommand{\headrulewidth}{0pt} % Remove header line \renewcommand{\seqinsert}{\ifmmode\allowbreak\else\-\fi} % Hyphens in seqsplit % This two commands together give roughly % the right line height in the tables \renewcommand{\arraystretch}{1.3} \onehalfspacing % Commands \newcommand{\SetRowColor}[1]{\noalign{\gdef\RowColorName{#1}}\rowcolor{\RowColorName}} % Shortcut for row colour \newcommand{\mymulticolumn}[3]{\multicolumn{#1}{>{\columncolor{\RowColorName}}#2}{#3}} % For coloured multi-cols \newcolumntype{x}[1]{>{\raggedright}p{#1}} % New column types for ragged-right paragraph columns \newcommand{\tn}{\tabularnewline} % Required as custom column type in use % Font and Colours \definecolor{HeadBackground}{HTML}{333333} \definecolor{FootBackground}{HTML}{666666} \definecolor{TextColor}{HTML}{333333} \definecolor{DarkBackground}{HTML}{5A68A5} \definecolor{LightBackground}{HTML}{F4F5F9} \renewcommand{\familydefault}{\sfdefault} \color{TextColor} % Header and Footer \pagestyle{fancy} \fancyhead{} % Set header to blank \fancyfoot{} % Set footer to blank \fancyhead[L]{ \noindent \begin{multicols}{3} \begin{tabulary}{5.8cm}{C} \SetRowColor{DarkBackground} \vspace{-7pt} {\parbox{\dimexpr\textwidth-2\fboxsep\relax}{\noindent \hspace*{-6pt}\includegraphics[width=5.8cm]{/web/www.cheatography.com/public/images/cheatography_logo.pdf}} } \end{tabulary} \columnbreak \begin{tabulary}{11cm}{L} \vspace{-2pt}\large{\bf{\textcolor{DarkBackground}{\textrm{PHP Cheat Sheet}}}} \\ \normalsize{by \textcolor{DarkBackground}{Dave Child (DaveChild)} via \textcolor{DarkBackground}{\uline{cheatography.com/1/cs/2/}}} \end{tabulary} \end{multicols}} \fancyfoot[L]{ \footnotesize \noindent \begin{multicols}{3} \begin{tabulary}{5.8cm}{LL} \SetRowColor{FootBackground} \mymulticolumn{2}{p{5.377cm}}{\bf\textcolor{white}{Cheatographer}} \\ \vspace{-2pt}Dave Child (DaveChild) \\ \uline{cheatography.com/davechild} \\ \uline{\seqsplit{aloneonahill}.com} \end{tabulary} \vfill \columnbreak \begin{tabulary}{5.8cm}{L} \SetRowColor{FootBackground} \mymulticolumn{1}{p{5.377cm}}{\bf\textcolor{white}{Cheat Sheet}} \\ \vspace{-2pt}Published 19th October, 2011.\\ Updated 29th February, 2020.\\ Page {\thepage} of \pageref{LastPage}. \end{tabulary} \vfill \columnbreak \begin{tabulary}{5.8cm}{L} \SetRowColor{FootBackground} \mymulticolumn{1}{p{5.377cm}}{\bf\textcolor{white}{Sponsor}} \\ \SetRowColor{white} \vspace{-5pt} %\includegraphics[width=48px,height=48px]{dave.jpeg} Measure your website readability!\\ www.readability-score.com \end{tabulary} \end{multicols}} \begin{document} \raggedright \raggedcolumns % Set font size to small. Switch to any value % from this page to resize cheat sheet text: % www.emerson.emory.edu/services/latex/latex_169.html \footnotesize % Small font. \begin{multicols*}{3} \begin{tabularx}{5.377cm}{p{0.4977 cm} p{0.4977 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{PHP Array Functions}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{2}{x{5.377cm}}{\{\{noshy\}\}\{\{popup="http://php.net/array\_diff"\}\}array\_diff (arr1, arr2 ...)} \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} \mymulticolumn{2}{x{5.377cm}}{\{\{noshy\}\}\{\{popup="http://php.net/array\_diff"\}\}array\_filter (arr, function)} \tn % Row Count 4 (+ 2) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{2}{x{5.377cm}}{\{\{noshy\}\}\{\{popup="http://php.net/array\_diff"\}\}array\_flip (arr)} \tn % Row Count 6 (+ 2) % Row 3 \SetRowColor{white} \mymulticolumn{2}{x{5.377cm}}{\{\{noshy\}\}\{\{popup="http://php.net/array\_intersect"\}\}array\_intersect (arr1, arr2 ...)} \tn % Row Count 8 (+ 2) % Row 4 \SetRowColor{LightBackground} \mymulticolumn{2}{x{5.377cm}}{\{\{noshy\}\}\{\{popup="http://php.net/array\_merge"\}\}array\_merge (arr1, arr2 ...)} \tn % Row Count 10 (+ 2) % Row 5 \SetRowColor{white} \mymulticolumn{2}{x{5.377cm}}{\{\{noshy\}\}\{\{popup="http://php.net/array\_pop"\}\}array\_pop (arr)} \tn % Row Count 12 (+ 2) % Row 6 \SetRowColor{LightBackground} \mymulticolumn{2}{x{5.377cm}}{\{\{noshy\}\}\{\{popup="http://php.net/array\_push"\}\}array\_push (arr, var1, var2 ...)} \tn % Row Count 14 (+ 2) % Row 7 \SetRowColor{white} \mymulticolumn{2}{x{5.377cm}}{\{\{noshy\}\}\{\{popup="http://php.net/array\_reverse"\}\}array\_reverse (arr)} \tn % Row Count 16 (+ 2) % Row 8 \SetRowColor{LightBackground} \mymulticolumn{2}{x{5.377cm}}{\{\{noshy\}\}\{\{popup="http://php.net/array\_search"\}\}array\_search (needle, arr)} \tn % Row Count 18 (+ 2) % Row 9 \SetRowColor{white} \mymulticolumn{2}{x{5.377cm}}{\{\{noshy\}\}\{\{popup="http://php.net/array\_walk"\}\}array\_walk (arr, function)} \tn % Row Count 20 (+ 2) % Row 10 \SetRowColor{LightBackground} \mymulticolumn{2}{x{5.377cm}}{\{\{noshy\}\}\{\{popup="http://php.net/count"\}\}count (count)} \tn % Row Count 22 (+ 2) % Row 11 \SetRowColor{white} \mymulticolumn{2}{x{5.377cm}}{\{\{noshy\}\}\{\{popup="http://php.net/in\_array"\}\}in\_array (needle, haystack)} \tn % Row Count 24 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{PHP String Functions}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{\{\{noshy\}\}\{\{popup="http://php.net/crypt"\}\}crypt (str, salt)} \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{\{\{noshy\}\}\{\{popup="http://php.net/explode"\}\}explode (sep, str)} \tn % Row Count 4 (+ 2) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{\{\{noshy\}\}\{\{popup="http://php.net/implode"\}\}implode (glue, arr)} \tn % Row Count 6 (+ 2) % Row 3 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{\{\{noshy\}\}\{\{popup="http://php.net/nl2br"\}\}nl2br (str)} \tn % Row Count 8 (+ 2) % Row 4 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{\{\{noshy\}\}\{\{popup="http://php.net/sprintf"\}\}sprintf (frmt, args)} \tn % Row Count 10 (+ 2) % Row 5 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{\{\{noshy\}\}\{\{popup="http://php.net/strip\_tags"\}\}strip\_tags (str, allowed\_tags)} \tn % Row Count 12 (+ 2) % Row 6 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{\{\{noshy\}\}\{\{popup="http://php.net/str\_replace"\}\}str\_replace (search, replace, str)} \tn % Row Count 14 (+ 2) % Row 7 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{\{\{noshy\}\}\{\{popup="http://php.net/strpos"\}\}strpos (str, needle)} \tn % Row Count 16 (+ 2) % Row 8 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{\{\{noshy\}\}\{\{popup="http://php.net/strrev"\}\}strrev (str)} \tn % Row Count 18 (+ 2) % Row 9 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{\{\{noshy\}\}\{\{popup="http://php.net/strstr"\}\}strstr (str, needle)} \tn % Row Count 20 (+ 2) % Row 10 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{\{\{noshy\}\}\{\{popup="http://php.net/strtolower"\}\}strtolower (str)} \tn % Row Count 22 (+ 2) % Row 11 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{\{\{noshy\}\}\{\{popup="http://php.net/strtoupper"\}\}strtoupper (str)} \tn % Row Count 24 (+ 2) % Row 12 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{\{\{noshy\}\}\{\{popup="http://php.net/substr"\}\}substr (string, start, len)} \tn % Row Count 26 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{PHP Filesystem Functions}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{\{\{noshy\}\}\{\{popup="http://php.net/clearstatcache"\}\}clearstatcache ()} \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{\{\{noshy\}\}\{\{popup="http://php.net/copy"\}\}copy (source, dest)} \tn % Row Count 4 (+ 2) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{\{\{noshy\}\}\{\{popup="http://php.net/fclose"\}\}fclose (handle)} \tn % Row Count 6 (+ 2) % Row 3 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{\{\{noshy\}\}\{\{popup="http://php.net/fgets"\}\}fgets (handle, len)} \tn % Row Count 8 (+ 2) % Row 4 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{\{\{noshy\}\}\{\{popup="http://php.net/file"\}\}file (file)} \tn % Row Count 10 (+ 2) % Row 5 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{\{\{noshy\}\}\{\{popup="http://php.net/filemtime"\}\}filemtime (file)} \tn % Row Count 12 (+ 2) % Row 6 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{\{\{noshy\}\}\{\{popup="http://php.net/filesize"\}\}filesize (file)} \tn % Row Count 14 (+ 2) % Row 7 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{\{\{noshy\}\}\{\{popup="http://php.net/file\_exists"\}\}file\_exists (file)} \tn % Row Count 16 (+ 2) % Row 8 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{\{\{noshy\}\}\{\{popup="http://php.net/fopen"\}\}fopen (file, mode)} \tn % Row Count 18 (+ 2) % Row 9 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{\{\{noshy\}\}\{\{popup="http://php.net/fread"\}\}fread (handle, len)} \tn % Row Count 20 (+ 2) % Row 10 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{\{\{noshy\}\}\{\{popup="http://php.net/fwrite"\}\}fwrite (handle, str)} \tn % Row Count 22 (+ 2) % Row 11 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{\{\{noshy\}\}\{\{popup="http://php.net/readfile"\}\}readfile (file)} \tn % Row Count 24 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{PHP Date and Time Functions}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{\{\{noshy\}\}\{\{popup="http://php.net/checkdate"\}\}checkdate (month, day, year)} \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{\{\{noshy\}\}\{\{popup="http://php.net/date"\}\}date (format, timestamp)} \tn % Row Count 4 (+ 2) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{\{\{noshy\}\}\{\{popup="http://php.net/getdate"\}\}getdate (timestamp)} \tn % Row Count 6 (+ 2) % Row 3 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{\{\{noshy\}\}\{\{popup="http://php.net/mktime"\}\}mktime (hr, min, sec, month, day, yr)} \tn % Row Count 8 (+ 2) % Row 4 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{\{\{noshy\}\}\{\{popup="http://php.net/strftime"\}\}strftime (formatstring, timestamp)} \tn % Row Count 10 (+ 2) % Row 5 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{\{\{noshy\}\}\{\{popup="http://php.net/strtotime"\}\}strtotime (str)} \tn % Row Count 12 (+ 2) % Row 6 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{\{\{noshy\}\}\{\{popup="http://php.net/time"\}\}time ()} \tn % Row Count 13 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{PHP Regular Expressions Functions}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{\{\{noshy\}\}\{\{popup="http://php.net/ereg"\}\}ereg (pattern, str)} \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{\{\{noshy\}\}\{\{popup="http://php.net/split"\}\}split (pattern, str)} \tn % Row Count 4 (+ 2) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{\{\{noshy\}\}\{\{popup="http://php.net/ereg\_replace"\}\}ereg\_replace (pattern, replace, str)} \tn % Row Count 6 (+ 2) % Row 3 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{\{\{noshy\}\}\{\{popup="http://php.net/preg\_grep"\}\}preg\_grep (pattern, arr)} \tn % Row Count 8 (+ 2) % Row 4 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{\{\{noshy\}\}\{\{popup="http://php.net/preg\_match"\}\}preg\_match (pattern, str)} \tn % Row Count 10 (+ 2) % Row 5 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{\{\{noshy\}\}\{\{popup="http://php.net/preg\_match\_all"\}\}preg\_match\_all (pattern, str, arr)} \tn % Row Count 12 (+ 2) % Row 6 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{\{\{noshy\}\}\{\{popup="http://php.net/preg\_replace"\}\}preg\_replace (pattern, replace, str)} \tn % Row Count 14 (+ 2) % Row 7 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{\{\{noshy\}\}\{\{popup="http://php.net/preg\_split"\}\}preg\_split (pattern, str)} \tn % Row Count 16 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{1.44333 cm} x{3.53367 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Regular Expressions Syntax}} \tn % Row 0 \SetRowColor{LightBackground} \textasciicircum{} & Start of string \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} \$ & End of string \tn % Row Count 2 (+ 1) % Row 2 \SetRowColor{LightBackground} . & Any single character \tn % Row Count 3 (+ 1) % Row 3 \SetRowColor{white} (a|b) & a or b \tn % Row Count 4 (+ 1) % Row 4 \SetRowColor{LightBackground} (...) & Group section \tn % Row Count 5 (+ 1) % Row 5 \SetRowColor{white} {[}abc{]} & In range (a, b or c) \tn % Row Count 6 (+ 1) % Row 6 \SetRowColor{LightBackground} {[}\textasciicircum{}abc{]} & Not in range \tn % Row Count 7 (+ 1) % Row 7 \SetRowColor{white} \textbackslash{}s & White space \tn % Row Count 8 (+ 1) % Row 8 \SetRowColor{LightBackground} a? & Zero or one of a \tn % Row Count 9 (+ 1) % Row 9 \SetRowColor{white} a* & Zero or more of a \tn % Row Count 10 (+ 1) % Row 10 \SetRowColor{LightBackground} a*? & Zero or more, ungreedy \tn % Row Count 11 (+ 1) % Row 11 \SetRowColor{white} a+ & One or more of a \tn % Row Count 12 (+ 1) % Row 12 \SetRowColor{LightBackground} a+? & One or more, ungreedy \tn % Row Count 13 (+ 1) % Row 13 \SetRowColor{white} a\{3\} & Exactly 3 of a \tn % Row Count 14 (+ 1) % Row 14 \SetRowColor{LightBackground} a\{3,\} & 3 or more of a \tn % Row Count 15 (+ 1) % Row 15 \SetRowColor{white} a\{,6\} & Up to 6 of a \tn % Row Count 16 (+ 1) % Row 16 \SetRowColor{LightBackground} a\{3,6\} & 3 to 6 of a \tn % Row Count 17 (+ 1) % Row 17 \SetRowColor{white} a\{3,6\}? & 3 to 6 of a, ungreedy \tn % Row Count 18 (+ 1) % Row 18 \SetRowColor{LightBackground} \textbackslash{} & Escape character \tn % Row Count 19 (+ 1) % Row 19 \SetRowColor{white} {[}:punct:{]} & Any punctuation symbol \tn % Row Count 20 (+ 1) % Row 20 \SetRowColor{LightBackground} {[}:space:{]} & Any space character \tn % Row Count 21 (+ 1) % Row 21 \SetRowColor{white} {[}:blank:{]} & Space or tab \tn % Row Count 22 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}--} \SetRowColor{LightBackground} \mymulticolumn{2}{x{5.377cm}}{There's an excellent regular expression tester at: http://regexpal.com/} \tn \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{0.84609 cm} x{4.13091 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Pattern Modifiers}} \tn % Row 0 \SetRowColor{LightBackground} g & Global match \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} i~* & Case-insensitive \tn % Row Count 3 (+ 2) % Row 2 \SetRowColor{LightBackground} m~* & Multiple lines \tn % Row Count 5 (+ 2) % Row 3 \SetRowColor{white} s~* & Treat string as single line \tn % Row Count 7 (+ 2) % Row 4 \SetRowColor{LightBackground} x~* & Allow comments and whitespace in pattern \tn % Row Count 9 (+ 2) % Row 5 \SetRowColor{white} e~* & Evaluate replacement \tn % Row Count 11 (+ 2) % Row 6 \SetRowColor{LightBackground} U~* & Ungreedy pattern \tn % Row Count 13 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \SetRowColor{LightBackground} \mymulticolumn{2}{x{5.377cm}}{* PCRE modifier} \tn \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{p{0.4977 cm} x{4.4793 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{PHP fopen() Modes}} \tn % Row 0 \SetRowColor{LightBackground} r & Read \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} r+ & Read and write, prepend \tn % Row Count 2 (+ 1) % Row 2 \SetRowColor{LightBackground} w & Write, truncate \tn % Row Count 3 (+ 1) % Row 3 \SetRowColor{white} w+ & Read and write, truncate \tn % Row Count 4 (+ 1) % Row 4 \SetRowColor{LightBackground} a & Write, append \tn % Row Count 5 (+ 1) % Row 5 \SetRowColor{white} a+ & Read and write, append \tn % Row Count 6 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{p{0.4977 cm} x{4.4793 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{PHP Date Formatting}} \tn % Row 0 \SetRowColor{LightBackground} Y & 4 digit year (2008) \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} y & 2 digit year (08) \tn % Row Count 2 (+ 1) % Row 2 \SetRowColor{LightBackground} F & Long month (January) \tn % Row Count 3 (+ 1) % Row 3 \SetRowColor{white} M & Short month (Jan) \tn % Row Count 4 (+ 1) % Row 4 \SetRowColor{LightBackground} m & Month $^{\textrm{4}}$ (01 to 12) \tn % Row Count 5 (+ 1) % Row 5 \SetRowColor{white} n & Month (1 to 12) \tn % Row Count 6 (+ 1) % Row 6 \SetRowColor{LightBackground} D & Short day name (Mon) \tn % Row Count 7 (+ 1) % Row 7 \SetRowColor{white} l & Long day name (Monday) (lowercase L) \tn % Row Count 8 (+ 1) % Row 8 \SetRowColor{LightBackground} d & Day $^{\textrm{4}}$ (01 to 31) \tn % Row Count 9 (+ 1) % Row 9 \SetRowColor{white} j & Day (1 to 31) \tn % Row Count 10 (+ 1) % Row 10 \SetRowColor{LightBackground} \mymulticolumn{2}{x{5.377cm}}{} \tn % Row Count 10 (+ 0) % Row 11 \SetRowColor{white} h & 12 Hour $^{\textrm{4}}$ (01 to 12) \tn % Row Count 11 (+ 1) % Row 12 \SetRowColor{LightBackground} g & 12 Hour (1 to 12) \tn % Row Count 12 (+ 1) % Row 13 \SetRowColor{white} H & 24 Hour $^{\textrm{4}}$ (00 to 23) \tn % Row Count 13 (+ 1) % Row 14 \SetRowColor{LightBackground} G & 24 Hour (0 to 23) \tn % Row Count 14 (+ 1) % Row 15 \SetRowColor{white} i & Minutes $^{\textrm{4}}$ (00 to 59) \tn % Row Count 15 (+ 1) % Row 16 \SetRowColor{LightBackground} s & Seconds $^{\textrm{4}}$ (00 to 59) \tn % Row Count 16 (+ 1) % Row 17 \SetRowColor{white} \mymulticolumn{2}{x{5.377cm}}{} \tn % Row Count 16 (+ 0) % Row 18 \SetRowColor{LightBackground} w & Day of week $^{\textrm{1}}$ (0 to 6) \tn % Row Count 17 (+ 1) % Row 19 \SetRowColor{white} z & Day of year (0 to 365) \tn % Row Count 18 (+ 1) % Row 20 \SetRowColor{LightBackground} W & Week of year $^{\textrm{2}}$ (1 to 53) \tn % Row Count 19 (+ 1) % Row 21 \SetRowColor{white} t & Days in month (28 to 31) \tn % Row Count 20 (+ 1) % Row 22 \SetRowColor{LightBackground} \mymulticolumn{2}{x{5.377cm}}{} \tn % Row Count 20 (+ 0) % Row 23 \SetRowColor{white} a & am or pm \tn % Row Count 21 (+ 1) % Row 24 \SetRowColor{LightBackground} A & AM or PM \tn % Row Count 22 (+ 1) % Row 25 \SetRowColor{white} B & Swatch Internet Time (000 to 999) \tn % Row Count 23 (+ 1) % Row 26 \SetRowColor{LightBackground} S & Ordinal Suffix (st, nd, rd, th) \tn % Row Count 24 (+ 1) % Row 27 \SetRowColor{white} \mymulticolumn{2}{x{5.377cm}}{} \tn % Row Count 24 (+ 0) % Row 28 \SetRowColor{LightBackground} T & Timezone of machine (GMT) \tn % Row Count 25 (+ 1) % Row 29 \SetRowColor{white} Z & Timezone offset (seconds) \tn % Row Count 26 (+ 1) % Row 30 \SetRowColor{LightBackground} O & GMT offset (hours) (+0200) \tn % Row Count 27 (+ 1) % Row 31 \SetRowColor{white} I & Daylight saving (1 or 0) \tn % Row Count 28 (+ 1) % Row 32 \SetRowColor{LightBackground} L & Leap year (1 or 0) \tn % Row Count 29 (+ 1) % Row 33 \SetRowColor{white} \mymulticolumn{2}{x{5.377cm}}{} \tn % Row Count 29 (+ 0) % Row 34 \SetRowColor{LightBackground} U & Seconds since Epoch $^{\textrm{3}}$ \tn % Row Count 30 (+ 1) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{5.377cm}{p{0.4977 cm} x{4.4793 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{PHP Date Formatting (cont)}} \tn % Row 35 \SetRowColor{LightBackground} c & ISO 8601 (PHP 5) \seqsplit{(2008-07-31T18:30:13+01:00)} \tn % Row Count 2 (+ 2) % Row 36 \SetRowColor{white} r & RFC 2822 (Thu, 31 Jul 2008 18:30:13 +0100) \tn % Row Count 4 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \SetRowColor{LightBackground} \mymulticolumn{2}{x{5.377cm}}{$^{\textrm{1}}$ 0 is Sunday, 6 is Saturday. \newline $^{\textrm{2}}$ Week that overlaps two years belongs to year that contains most days of that week. Hence week number for 1st January of a given year can be 53 if week belongs to previous year. date("W", mktime(0, 0, 0, 12, 8, \$year)) always gives correct number of weeks in \$year. \newline $^{\textrm{3}}$ The Epoch is the 1st January 1970. \newline $^{\textrm{4}}$ With leading zeroes} \tn \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} % That's all folks \end{multicols*} \end{document}