\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{karael} \pdfinfo{ /Title (php-7.pdf) /Creator (Cheatography) /Author (karael) /Subject (PHP 7 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}{0F4FA3} \definecolor{LightBackground}{HTML}{F0F4F9} \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 7 Cheat Sheet}}}} \\ \normalsize{by \textcolor{DarkBackground}{karael} via \textcolor{DarkBackground}{\uline{cheatography.com/76917/cs/18894/}}} \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}karael \\ \uline{cheatography.com/karael} \\ \end{tabulary} \vfill \columnbreak \begin{tabulary}{5.8cm}{L} \SetRowColor{FootBackground} \mymulticolumn{1}{p{5.377cm}}{\bf\textcolor{white}{Cheat Sheet}} \\ \vspace{-2pt}Not Yet Published.\\ Updated 20th February, 2019.\\ 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}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{maths}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{+\$a //Conversion de \$a vers int ou float \newline -\$a //Opposé \newline \$a / \$b ou intdiv(\$a, \$b) //Quotient \newline \$a \% \$b ou fmod(\$a, \$b) //Reste \newline \$a ** \$b ou pow(\$a, \$b) //Exponentielle \newline (\$a \% 2) === 0 ou \$a \& 1 //paire \newline (\$a \% 2) === 1 ou \$a \& 0//impaire} \tn \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 7 tips}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{//Spaceship \newline echo 1 \textless{}=\textgreater{} 1; // 0 \newline echo 1 \textless{}=\textgreater{} 2; // -1 \newline echo 2 \textless{}=\textgreater{} 1; // 1 \newline \newline //Null coalescent eq ternaire if isset ? 1 : 0 \newline \$x = \$test1Null ?? \$test2Null ?? \$test3NonNull; \newline \newline //type scalaire \newline function arraySum(array ...\$tab) \newline \{ \newline return \seqsplit{array\_map(function(array} \$tab) \{ \newline return array\_sum(\$tab); \newline \}, \$tab); \newline \} \newline resultat =\textgreater{} Array ({[}0{]} =\textgreater{} 6, {[}1{]} =\textgreater{} 15) \newline \newline //types de retours \newline ?objet void \newline \newline //multiple catch \newline try \{\} \newline catch (Exception1 \$e | Exception2 \$e)\{\} \newline finaly \{\}} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{regex}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{// fonctions \newline preg\_match \newline preg\_match\_all \newline preg\_replace \newline preg\_replace\_callback \newline preg\_replace\_callback\_array \newline preg\_grep \newline preg\_split \newline \newline // search \newline {[}abc{]} A single character of: a, b or c \newline {[}\textasciicircum{}abc{]} Any single character except: a, b, or c \newline {[}a-z{]} Any single character in the range a-z \newline {[}a-zA-Z{]} Any single character in the range a-z or A-Z \newline \textasciicircum{} Start of line \newline \$ End of line \newline \textbackslash{}A Start of string \newline \textbackslash{}z End of string \newline . Any single character \newline \textbackslash{}s Any whitespace character \newline \textbackslash{}S Any non-whitespace character \newline \textbackslash{}d Any digit \newline \textbackslash{}D Any non-digit \newline \textbackslash{}w Any word character (letter, number, underscore) \newline \textbackslash{}W Any non-word character \newline \textbackslash{}b Any word boundary \newline (...) Capture everything enclosed \newline (a|b) a or b \newline a? Zero or one of a \newline a* Zero or more of a \newline a+ One or more of a \newline a\{3\} Exactly 3 of a \newline a\{3,\} 3 or more of a \newline a\{3,6\} Between 3 and 6 of a \newline \newline //options \newline i case insensitive \newline m treat as multi-line string \newline s dot matches newline \newline x ignore whitespace in regex  \newline A matches only at the start of string  \newline D matches only at the end of string  \newline U non-greedy matching by default} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{array}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{array\_change\_key\_case \newline array\_chunk \newline array\_combine \newline array\_count\_values \newline array\_fill\_keys \newline array\_fill \& array\_pad (limit) \newline array\_flip \newline array\_map \newline array\_replace\_recursive // Remplace récursivement dans le premier tableau les éléments des autres tableaux fournis \newline array\_replace // Remplace les éléments d'un tableau par ceux d'autres tableaux \newline list // Crée un tableau à partir de variables et de leur valeur \newline range \newline \newline array\_diff\_assoc // key \& values \newline array\_diff\_key \newline array\_diff\_uassoc // callback \newline array\_diff\_ukey // key callback \newline array\_diff // value callback \newline // ou intersect udiff uintersec (u = key) \newline \newline array\_merge\_recursive \newline array\_merge \newline array\_multisort \newline \newline //math \newline array\_product // produit \newline array\_sum // somme \newline \newline array\_reverse // Inverse l'ordre des éléments d'un tableau \newline array\_search // Recherche dans un tableau la clé associée à la première valeur \newline array\_shift // Dépile un élément au début d'un tableau \newline array\_slice // Extrait une portion de tableau \newline array\_splice // Efface et remplace une portion de tableau \newline \newline array\_unique // Dédoublonne un tableau \newline array\_unshift // Empile un ou plusieurs éléments au début d'un tableau} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{string}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{explode // Scinde une chaîne de caractères en segments \newline implode // Rassemble les éléments d'un tableau en une chaîne \newline lcfirst // Met le premier caractère en minuscule \newline ltrim // Supprime les espaces (ou d'autres caractères) de début de chaîne \newline rtrim // Supprime les espaces (ou d'autres caractères) de fin de chaîne \newline parse\_str // Analyse une chaîne de caractères d'une variable \newline sscanf // Analyse une chaîne à l'aide d'un format \newline str\_pad // Complète une chaîne jusqu'à une taille donnée \newline str\_repeat // Répète une chaîne \newline str\_replace // Remplace toutes les occurrences dans une chaîne \newline str\_shuffle // Mélange les caractères d'une chaîne de caractères \newline str\_split // Convertit une chaîne de caractères en tableau \newline str\_word\_count // Compte le nombre de mots utilisés dans une chaîne \newline strcspn // Trouve un segment de chaîne ne contenant pas certains caractères \newline strip\_tags // Supprime les balises HTML et PHP d'une chaîne \newline strlen // Calcule la taille d'une chaîne \newline strpbrk // Recherche un ensemble de caractères dans une chaîne de caractères \newline strpos // Cherche la position de la première occurrence dans une chaîne \newline strrchr // Trouve la dernière occurrence d'un caractère dans une chaîne \newline strrev // Inverse une chaîne \newline strrpos // Cherche la position de la dernière occurrence d'une sous-chaîne \newline strspn // Trouve la longueur du segment initial d'une chaîne contenant tous les caractères d'un masque donné \newline strstr // Trouve la première occurrence dans une chaîne \newline strtolower // Renvoie une chaîne en minuscules \newline strtoupper // Renvoie une chaîne en majuscules \newline strtr // Remplace des caractères dans une chaîne \newline substr\_compare // Compare deux chaînes depuis un offset jusqu'à une longueur en caractères \newline substr\_count // Compte le nombre d'occurrences de segments dans une chaîne \newline substr\_replace // Remplace un segment dans une chaîne \newline substr // Retourne un segment de chaîne \newline trim // Supprime les espaces (ou d'autres caractères) en début et fin de chaîne \newline ucfirst // Met le premier caractère en majuscule \newline ucwords // Met en majuscule la première lettre de tous les mots} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} % That's all folks \end{multicols*} \end{document}