\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{sanis} \pdfinfo{ /Title (php-functions-for-zce.pdf) /Creator (Cheatography) /Author (sanis) /Subject (PHP functions for ZCE 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}{FFB300} \definecolor{LightBackground}{HTML}{FFFAEF} \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 functions for ZCE Cheat Sheet}}}} \\ \normalsize{by \textcolor{DarkBackground}{sanis} via \textcolor{DarkBackground}{\uline{cheatography.com/30174/cs/8946/}}} \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}sanis \\ \uline{cheatography.com/sanis} \\ \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 27th August, 2016.\\ 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{tabularx}{17.67cm}{x{5.7358 cm} x{5.5671 cm} x{5.5671 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{17.67cm}}{\bf\textcolor{white}{Array functions}} \tn % Row 0 \SetRowColor{LightBackground} array \seqsplit{array\_change\_key\_case} ( array \$array {[}, int \$case = CASE\_LOWER {]} ) & Returns an array with all keys from array lowercased or uppercased. Numbered indices are left as is. & Returns an array with its keys lower or uppercased, or FALSE if array is not an array. \tn % Row Count 8 (+ 8) % Row 1 \SetRowColor{white} array array\_chunk ( array \$array , int \$size {[}, bool \seqsplit{\$preserve\_keys} = false {]} ) & Chunks an array into arrays with size elements. The last chunk may contain less than size elements. & Returns a \seqsplit{multidimensional} numerically indexed array, starting with zero, with each dimension containing size elements. \tn % Row Count 18 (+ 10) % Row 2 \SetRowColor{LightBackground} array \seqsplit{array\_column} ( array \$input , mixed \seqsplit{\$column\_key} {[}, mixed \$index\_key = null {]} ) & returns the values from a single column of the input, identified by the column\_key. Optionally, an index\_key may be provided to index the values in the returned array by the values from the index\_key column of the input array. & Returns an array of values representing a single column from the input array. \tn % Row Count 36 (+ 18) \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{17.67cm}{x{5.7358 cm} x{5.5671 cm} x{5.5671 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{17.67cm}}{\bf\textcolor{white}{Array functions (cont)}} \tn % Row 3 \SetRowColor{LightBackground} array \seqsplit{array\_combine} ( array \$keys , array \$values ) & Creates an array by using the values from the keys array as keys and the values from the values array as the \seqsplit{corresponding} values. & Returns the combined array, FALSE if the number of elements for each array isn't equal. \tn % Row Count 10 (+ 10) % Row 4 \SetRowColor{white} array \seqsplit{array\_count\_values} ( array \$array ) & \seqsplit{array\_count\_values()} returns an array using the values of array as keys and their frequency in array as values. & Returns an associative array of values from array as keys and their count as value. \tn % Row Count 19 (+ 9) % Row 5 \SetRowColor{LightBackground} array \seqsplit{array\_diff\_assoc} ( array \$array1 , array \$array2 {[}, array \$... {]} ) & Compares array1 against array2 and returns the difference. Unlike \seqsplit{array\_diff()} the array keys are also used in the comparison. & Returns an array containing all the values from array1 that are not present in any of the other arrays. \tn % Row Count 29 (+ 10) % Row 6 \SetRowColor{white} array \seqsplit{array\_diff\_key} ( array \$array1 , array \$array2 {[}, array \$... {]} ) & Compares the keys from array1 against the keys from array2 and returns the difference. This function is like \seqsplit{array\_diff()} except the comparison is done on the keys instead of the values. & Returns an array containing all the entries from array1 whose keys are not present in any of the other arrays. \tn % Row Count 44 (+ 15) \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{17.67cm}{x{5.7358 cm} x{5.5671 cm} x{5.5671 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{17.67cm}}{\bf\textcolor{white}{Array functions (cont)}} \tn % Row 7 \SetRowColor{LightBackground} array \seqsplit{array\_diff\_uassoc} ( array \$array1 , array \$array2 {[}, array \$... {]}, callable \seqsplit{\$key\_compare\_func} ) & Compares array1 against array2 and returns the difference. Unlike \seqsplit{array\_diff()} the array keys are used in the comparison. Unlike \seqsplit{array\_diff\_assoc()} an user supplied callback function is used for the indices comparison, not internal function. & Returns an array containing all the entries from array1 that are not present in any of the other arrays. \tn % Row Count 19 (+ 19) % Row 8 \SetRowColor{white} array \seqsplit{array\_diff\_ukey} ( array \$array1 , array \$array2 {[}, array \$... {]}, callable \seqsplit{\$key\_compare\_func} ) & Compares the keys from array1 against the keys from array2 and returns the difference. This function is like \seqsplit{array\_diff()} except the comparison is done on the keys instead of the values. Unlike \seqsplit{array\_diff\_key()} a user supplied callback function is used for the indices comparison, not internal function. & Returns an array containing all the entries from array1 that are not present in any of the other arrays. \tn % Row Count 43 (+ 24) \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{17.67cm}{x{5.7358 cm} x{5.5671 cm} x{5.5671 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{17.67cm}}{\bf\textcolor{white}{Array functions (cont)}} \tn % Row 9 \SetRowColor{LightBackground} array array\_diff ( array \$array1 , array \$array2 {[}, array \$... {]} ) & Compares array1 against one or more other arrays and returns the values in array1 that are not present in any of the other arrays. & Returns an array containing all the entries from array1 that are not present in any of the other arrays. \tn % Row Count 10 (+ 10) % Row 10 \SetRowColor{white} array \seqsplit{array\_fill\_keys} ( array \$keys , mixed \$value ) & Fills an array with the value of the value parameter, using the values of the keys array as keys. & Returns the filled array \tn % Row Count 18 (+ 8) % Row 11 \SetRowColor{LightBackground} array array\_fill ( int \seqsplit{\$start\_index} , int \$num , mixed \$value ) & Fills an array with num entries of the value of the value parameter, keys starting at the start\_index parameter. & Returns the filled array \tn % Row Count 27 (+ 9) % Row 12 \SetRowColor{white} array \seqsplit{array\_filter} ( array \$array {[}, callable \$callback {[}, int \$flag = 0 {]}{]} ) & Iterates over each value in the array passing them to the callback function. If the callback function returns true, the current value from array is returned into the result array. Array keys are preserved. & Returns the filtered array. \tn % Row Count 43 (+ 16) \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{17.67cm}{x{5.7358 cm} x{5.5671 cm} x{5.5671 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{17.67cm}}{\bf\textcolor{white}{Array functions (cont)}} \tn % Row 13 \SetRowColor{LightBackground} array array\_flip ( array \$array ) & \seqsplit{array\_flip()} returns an array in flip order, i.e. keys from array become values and values from array become keys. Note that the values of array need to be valid keys, i.e. they need to be either integer or string. A warning will be emitted if a value has the wrong type, and the key/value pair in question will not be included in the result. If a value has several occurrences, the latest key will be used as its value, and all others will be lost. & Returns the flipped array on success and NULL on failure. \tn % Row Count 35 (+ 35) \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{17.67cm}{x{5.7358 cm} x{5.5671 cm} x{5.5671 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{17.67cm}}{\bf\textcolor{white}{Array functions (cont)}} \tn % Row 14 \SetRowColor{LightBackground} array \seqsplit{array\_intersect\_assoc} ( array \$array1 , array \$array2 {[}, array \$... {]} ) & \seqsplit{array\_intersect\_assoc()} returns an array containing all the values of array1 that are present in all the arguments. Note that the keys are also used in the comparison unlike in \seqsplit{array\_intersect()}. & Returns an associative array containing all the values in array1 that are present in all of the arguments. \tn % Row Count 15 (+ 15) % Row 15 \SetRowColor{white} array \seqsplit{array\_intersect\_key} ( array \$array1 , array \$array2 {[}, array \$... {]} ) & \seqsplit{array\_intersect\_key()} returns an array containing all the entries of array1 which have keys that are present in all the arguments. & Returns an associative array containing all the entries of array1 which have keys that are present in all arguments. \tn % Row Count 25 (+ 10) % Row 16 \SetRowColor{LightBackground} array \seqsplit{array\_intersect\_uassoc} ( array \$array1 , array \$array2 {[}, array \$... {]}, callable \seqsplit{\$key\_compare\_func} ) & \seqsplit{array\_intersect\_uassoc()} returns an array containing all the values of array1 that are present in all the arguments. Note that the keys are used in the comparison unlike in \seqsplit{array\_intersect()}. & Returns the values of array1 whose values exist in all of the arguments. \tn % Row Count 40 (+ 15) \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{17.67cm}{x{5.7358 cm} x{5.5671 cm} x{5.5671 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{17.67cm}}{\bf\textcolor{white}{Array functions (cont)}} \tn % Row 17 \SetRowColor{LightBackground} array \seqsplit{array\_intersect\_ukey} ( array \$array1 , array \$array2 {[}, array \$... {]}, callable \seqsplit{\$key\_compare\_func} ) & \seqsplit{array\_intersect\_ukey()} returns an array containing all the values of array1 which have matching keys that are present in all the arguments. & Returns the values of array1 whose keys exist in all the arguments. \tn % Row Count 11 (+ 11) % Row 18 \SetRowColor{white} array \seqsplit{array\_intersect} ( array \$array1 , array \$array2 {[}, array \$... {]} ) & \seqsplit{array\_intersect()} returns an array containing all the values of array1 that are present in all the arguments. Note that keys are preserved. & Returns an array containing all of the values in array1 whose values exist in all of the parameters. \tn % Row Count 22 (+ 11) % Row 19 \SetRowColor{LightBackground} bool \seqsplit{array\_key\_exists} ( mixed \$key , array \$array ) & \seqsplit{array\_key\_exists()} returns TRUE if the given key is set in the array. key can be any value possible for an array index. & Returns TRUE on success or FALSE on failure. \tn % Row Count 32 (+ 10) \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{17.67cm}{x{5.7358 cm} x{5.5671 cm} x{5.5671 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{17.67cm}}{\bf\textcolor{white}{Array functions (cont)}} \tn % Row 20 \SetRowColor{LightBackground} array array\_keys ( array \$array {[}, mixed \seqsplit{\$search\_value} = null {[}, bool \$strict = false {]}{]} ) & \seqsplit{array\_keys()} returns the keys, numeric and string, from the array. If the optional \seqsplit{search\_value} is specified, then only the keys for that value are returned. Otherwise, all the keys from the array are returned. & Returns an array of all the keys in array. \tn % Row Count 17 (+ 17) % Row 21 \SetRowColor{white} array array\_map ( callable \$callback , array \$array1 {[}, array \$... {]} ) & array\_map() returns an array containing all the elements of array1 after applying the callback function to each one. The number of parameters that the callback function accepts should match the number of arrays passed to the array\_map() & Returns an array containing all the elements of array1 after applying the callback function to each one. \tn % Row Count 36 (+ 19) \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{17.67cm}{x{5.7358 cm} x{5.5671 cm} x{5.5671 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{17.67cm}}{\bf\textcolor{white}{Array functions (cont)}} \tn % Row 22 \SetRowColor{LightBackground} array \seqsplit{array\_merge\_recursive} ( array \$array1 {[}, array \$... {]} ) & \seqsplit{array\_merge\_recursive()} merges the elements of one or more arrays together so that the values of one are appended to the end of the previous one. It returns the resulting array. If the input arrays have the same string keys, then the values for these keys are merged together into an array, and this is done recursively, so that if one of the values is an array itself, the function will merge it with a \seqsplit{corresponding} entry in another array too. If, however, the arrays have the same numeric key, the later value will not overwrite the original value, but will be appended. & An array of values resulted from merging the arguments together. \tn % Row Count 45 (+ 45) \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{17.67cm}{x{5.7358 cm} x{5.5671 cm} x{5.5671 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{17.67cm}}{\bf\textcolor{white}{Array functions (cont)}} \tn % Row 23 \SetRowColor{LightBackground} array array\_merge ( array \$array1 {[}, array \$... {]} ) & Merges the elements of one or more arrays together so that the values of one are appended to the end of the previous one. It returns the resulting array. If the input arrays have the same string keys, then the later value for that key will overwrite the previous one. If, however, the arrays contain numeric keys, the later value will not overwrite the original value, but will be appended. Values in the input array with numeric keys will be renumbered with incrementing keys starting from zero in the result array. & Returns the resulting array. \tn % Row Count 40 (+ 40) \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{17.67cm}{x{5.7358 cm} x{5.5671 cm} x{5.5671 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{17.67cm}}{\bf\textcolor{white}{Array functions (cont)}} \tn % Row 24 \SetRowColor{LightBackground} bool \seqsplit{array\_multisort} ( array \&\$array1 {[}, mixed \seqsplit{\$array1\_sort\_order} = SORT\_ASC {[}, mixed \seqsplit{\$array1\_sort\_flags} = \seqsplit{SORT\_REGULAR} {[}, mixed \$... {]}{]}{]} ) & \seqsplit{array\_multisort()} can be used to sort several arrays at once, or a \seqsplit{multi-dimensional} array by one or more dimensions. Associative (string) keys will be maintained, but numeric keys will be re-indexed. & Returns TRUE on success or FALSE on failure. \tn % Row Count 16 (+ 16) % Row 25 \SetRowColor{white} array array\_pad ( array \$array , int \$size , mixed \$value ) & array\_pad() returns a copy of the array padded to size specified by size with value value. If size is positive then the array is padded on the right, if it's negative then on the left. If the absolute value of size is less than or equal to the length of the array then no padding takes place. It is possible to add at most 1048576 elements at a time. & Returns a copy of the array padded to size specified by size with value value. If size is positive then the array is padded on the right, if it's negative then on the left. If the absolute value of size is less than or equal to the length of the array then no padding takes place. \tn % Row Count 43 (+ 27) \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{17.67cm}{x{5.7358 cm} x{5.5671 cm} x{5.5671 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{17.67cm}}{\bf\textcolor{white}{Array functions (cont)}} \tn % Row 26 \SetRowColor{LightBackground} mixed array\_pop ( array \&\$array ) & array\_pop() pops and returns the last value of the array, shortening the array by one element. \{\{nl\}\} {\bf{Note}}: This function will reset() the array pointer of the input array after use. & Returns the last value of array. If array is empty (or is not an array), NULL will be returned. \tn % Row Count 15 (+ 15) % Row 27 \SetRowColor{white} number \seqsplit{array\_product} ( array \$array ) & \seqsplit{array\_product()} returns the product of values in an array. & Returns the product as an integer or float. \tn % Row Count 20 (+ 5) % Row 28 \SetRowColor{LightBackground} int array\_push ( array \&\$array , mixed \$value1 {[}, mixed \$... {]} ) & \seqsplit{array\_push()} treats array as a stack, and pushes the passed variables onto the end of array. The length of array increases by the number of variables pushed.\{\{nl\}\} {\bf{Note:}} If you use \seqsplit{array\_push()} to add one element to the array it's better to use \$array{[}{]} = because in that way there is no overhead of calling a function.\{\{nl\}\} {\bf{Note:}} \seqsplit{array\_push()} will raise a warning if the first argument is not an array. This differs from the \$var{[}{]} behaviour where a new array is created. & Returns the new number of elements in the array. \tn % Row Count 57 (+ 37) \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{17.67cm}{x{5.7358 cm} x{5.5671 cm} x{5.5671 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{17.67cm}}{\bf\textcolor{white}{Array functions (cont)}} \tn % Row 29 \SetRowColor{LightBackground} mixed array\_rand ( array \$array {[}, int \$num = 1 {]} ) & Picks one or more random entries out of an array, and returns the key (or keys) of the random entries. It uses a pseudo random number generator that is not suitable for \seqsplit{cryptographic} purposes. & When picking only one entry, \seqsplit{array\_rand()} returns the key for a random entry. Otherwise, an array of keys for the random entries is returned. This is done so that random keys can be picked from the array as well as random values. Trying to pick more elements than there are in the array will result in an E\_WARNING level error, and NULL will be returned. \tn % Row Count 28 (+ 28) % Row 30 \SetRowColor{white} mixed \seqsplit{array\_reduce} ( array \$array , callable \$callback {[}, mixed \$initial = NULL {]} ) & \seqsplit{array\_reduce()} applies iteratively the callback function to the elements of the array, so as to reduce the array to a single value. & Returns the resulting value. If the array is empty and initial is not passed, \seqsplit{array\_reduce()} returns NULL. \tn % Row Count 39 (+ 11) \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{17.67cm}{x{5.7358 cm} x{5.5671 cm} x{5.5671 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{17.67cm}}{\bf\textcolor{white}{Array functions (cont)}} \tn % Row 31 \SetRowColor{LightBackground} array \seqsplit{array\_replace\_recursive} ( array \$array1 , array \$array2 {[}, array \$... {]} ) & \seqsplit{array\_replace\_recursive()} replaces the values of array1 with the same values from all the following arrays. If a key from the first array exists in the second array, its value will be replaced by the value from the second array. If the key exists in the second array, and not the first, it will be created in the first array. If a key only exists in the first array, it will be left as is. If several arrays are passed for replacement, they will be processed in order, the later array overwriting the previous values. \seqsplit{array\_replace\_recursive()} is recursive : it will recurse into arrays and apply the same process to the inner value. When the value in array1 is scalar, it will be replaced by the value in array2, may it be scalar or array. When the value in array1 and array2 are both arrays, \seqsplit{array\_replace\_recursive()} will replace their respective value recursively. & Returns an array, or NULL if an error occurs. \tn % Row Count 67 (+ 67) \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{17.67cm}{x{5.7358 cm} x{5.5671 cm} x{5.5671 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{17.67cm}}{\bf\textcolor{white}{Array functions (cont)}} \tn % Row 32 \SetRowColor{LightBackground} array \seqsplit{array\_replace} ( array \$array1 , array \$array2 {[}, array \$... {]} ) & \seqsplit{array\_replace()} replaces the values of array1 with values having the same keys in each of the following arrays. If a key from the first array exists in the second array, its value will be replaced by the value from the second array. If the key exists in the second array, and not the first, it will be created in the first array. If a key only exists in the first array, it will be left as is. If several arrays are passed for replacement, they will be processed in order, the later arrays overwriting the previous values. \seqsplit{array\_replace()} is not recursive : it will replace values in the first array by whatever type is in the second array. & Returns an array, or NULL if an error occurs. \tn % Row Count 50 (+ 50) \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{17.67cm}{x{5.7358 cm} x{5.5671 cm} x{5.5671 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{17.67cm}}{\bf\textcolor{white}{Array functions (cont)}} \tn % Row 33 \SetRowColor{LightBackground} array \seqsplit{array\_reverse} ( array \$array {[}, bool \seqsplit{\$preserve\_keys} = false {]} ) & Takes an input array and returns a new array with the order of the elements reversed. & Returns the reversed array. \tn % Row Count 7 (+ 7) % Row 34 \SetRowColor{white} mixed \seqsplit{array\_search} ( mixed \$needle , array \$haystack {[}, bool \$strict = false {]} ) & Searches haystack for needle. & Returns the key for needle if it is found in the array, FALSE otherwise. If needle is found in haystack more than once, the first matching key is returned. To return the keys for all matching values, use \seqsplit{array\_keys()} with the optional \seqsplit{search\_value} parameter instead. \{\{nl\}\}Warning This function may return Boolean FALSE, but may also return a non-Boolean value which evaluates to FALSE. Please read the section on Booleans for more information. Use the === operator for testing the return value of this function. \tn % Row Count 47 (+ 40) \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{17.67cm}{x{5.7358 cm} x{5.5671 cm} x{5.5671 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{17.67cm}}{\bf\textcolor{white}{Array functions (cont)}} \tn % Row 35 \SetRowColor{LightBackground} mixed array\_shift ( array \&\$array ) & \seqsplit{array\_shift()} shifts the first value of the array off and returns it, shortening the array by one element and moving everything down. All numerical array keys will be modified to start counting from zero while literal keys won't be touched.\{\{nl\}\}Note: This function will reset() the array pointer of the input array after use. & Returns the shifted value, or NULL if array is empty or is not an array. \tn % Row Count 26 (+ 26) % Row 36 \SetRowColor{white} array array\_slice ( array \$array , int \$offset {[}, int \$length = NULL {[}, bool \seqsplit{\$preserve\_keys} = false {]}{]} ) & \seqsplit{array\_slice()} returns the sequence of elements from the array array as specified by the offset and length parameters. & Returns the slice. If the offset is larger than the size of the array then returns an empty array. \tn % Row Count 35 (+ 9) \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{17.67cm}{x{5.7358 cm} x{5.5671 cm} x{5.5671 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{17.67cm}}{\bf\textcolor{white}{Array functions (cont)}} \tn % Row 37 \SetRowColor{LightBackground} array \seqsplit{array\_splice} ( array \&\$input , int \$offset {[}, int \$length = 0 {[}, mixed \seqsplit{\$replacement} = array() {]}{]} ) & Removes the elements designated by offset and length from the input array, and replaces them with the elements of the replacement array, if supplied. Note that numeric keys in input are not preserved.\{\{nl\}\}Note: If replacement is not an array, it will be typecast to one (i.e. (array) \seqsplit{\$replacement)}. This may result in unexpected behavior when using an object or NULL replacement. & Returns an array consisting of the extracted elements. \tn % Row Count 30 (+ 30) \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{17.67cm}{x{5.7358 cm} x{5.5671 cm} x{5.5671 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{17.67cm}}{\bf\textcolor{white}{Array functions (cont)}} \tn % Row 38 \SetRowColor{LightBackground} number array\_sum ( array \$array ) & array\_sum() returns the sum of values in an array. & Returns the sum of values as an integer or float. \tn % Row Count 4 (+ 4) % Row 39 \SetRowColor{white} array \seqsplit{array\_udiff\_assoc} ( array \$array1 , array \$array2 {[}, array \$... {]}, callable \seqsplit{\$value\_compare\_func} ) & Computes the difference of arrays with additional index check, compares data by a callback function.\{\{nl\}\}Note: Please note that this function only checks one dimension of a \seqsplit{n-dimensional} array. Of course you can check deeper dimensions by using, for example, array\_udiff\_assoc(\$array1{[}0{]}, \$array2{[}0{]}, \seqsplit{"some\_comparison\_func");}. & \seqsplit{array\_udiff\_assoc()} returns an array containing all the values from array1 that are not present in any of the other arguments. Note that the keys are used in the comparison unlike \seqsplit{array\_diff()} and \seqsplit{array\_udiff()}. The comparison of arrays' data is performed by using an \seqsplit{user-supplied} callback. In this aspect the behaviour is opposite to the behaviour of \seqsplit{array\_diff\_assoc()} which uses internal function for comparison. \tn % Row Count 36 (+ 32) \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{17.67cm}{x{5.7358 cm} x{5.5671 cm} x{5.5671 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{17.67cm}}{\bf\textcolor{white}{Array functions (cont)}} \tn % Row 40 \SetRowColor{LightBackground} array \seqsplit{array\_udiff\_uassoc} ( array \$array1 , array \$array2 {[}, array \$... {]}, callable \seqsplit{\$value\_compare\_func} , callable \seqsplit{\$key\_compare\_func} ) & Computes the difference of arrays with additional index check, compares data and indexes by a callback function. Note that the keys are used in the comparison unlike \seqsplit{array\_diff()} and \seqsplit{array\_udiff()}. & Returns an array containing all the values from array1 that are not present in any of the other arguments. \tn % Row Count 16 (+ 16) % Row 41 \SetRowColor{white} array array\_udiff ( array \$array1 , array \$array2 {[}, array \$... {]}, callable \seqsplit{\$value\_compare\_func} ) & Computes the difference of arrays by using a callback function for data comparison. This is unlike \seqsplit{array\_diff()} which uses an internal function for comparing the data. & Returns an array containing all the values of array1 that are not present in any of the other arguments. \tn % Row Count 29 (+ 13) % Row 42 \SetRowColor{LightBackground} array \seqsplit{array\_uintersect\_assoc} ( array \$array1 , array \$array2 {[}, array \$... {]}, callable \seqsplit{\$value\_compare\_func} ) & Computes the intersection of arrays with additional index check, compares data by a callback function. Note that the keys are used in the comparison unlike in \seqsplit{array\_uintersect()}. The data is compared by using a callback function. & Returns an array containing all the values of array1 that are present in all the arguments. \tn % Row Count 47 (+ 18) \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{17.67cm}{x{5.7358 cm} x{5.5671 cm} x{5.5671 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{17.67cm}}{\bf\textcolor{white}{Array functions (cont)}} \tn % Row 43 \SetRowColor{LightBackground} array \seqsplit{array\_uintersect\_uassoc} ( array \$array1 , array \$array2 {[}, array \$... {]}, callable \seqsplit{\$value\_compare\_func} , callable \seqsplit{\$key\_compare\_func} ) & Computes the intersection of arrays with additional index check, compares data and indexes by separate callback functions. & Returns an array containing all the values of array1 that are present in all the arguments. \tn % Row Count 11 (+ 11) % Row 44 \SetRowColor{white} array \seqsplit{array\_uintersect} ( array \$array1 , array \$array2 {[}, array \$... {]}, callable \seqsplit{\$value\_compare\_func} ) & Computes the intersection of arrays, compares data by a callback function. & Returns an array containing all the values of array1 that are present in all the arguments. \tn % Row Count 19 (+ 8) % Row 45 \SetRowColor{LightBackground} array \seqsplit{array\_unique} ( array \$array {[}, int \seqsplit{\$sort\_flags} = SORT\_STRING {]} ) & Takes an input array and returns a new array without duplicate values. Note that keys are preserved. \seqsplit{array\_unique()} sorts the values treated as string at first, then will keep the first key encountered for every value, and ignore all following keys. It does not mean that the key of the first related value from the unsorted array will be kept.\{\{nl\}\}Note: Two elements are considered equal if and only if (string) \$elem1 === (string) \$elem2 i.e. when the string \seqsplit{representation} is the same, the first element will be used. & Returns the filtered array. \tn % Row Count 60 (+ 41) \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{17.67cm}{x{5.7358 cm} x{5.5671 cm} x{5.5671 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{17.67cm}}{\bf\textcolor{white}{Array functions (cont)}} \tn % Row 46 \SetRowColor{LightBackground} int \seqsplit{array\_unshift} ( array \&\$array , mixed \$value1 {[}, mixed \$... {]} ) & \seqsplit{array\_unshift()} prepends passed elements to the front of the array. Note that the list of elements is prepended as a whole, so that the prepended elements stay in the same order. All numerical array keys will be modified to start counting from zero while literal keys won't be touched. & Returns the new number of elements in the array. \tn % Row Count 22 (+ 22) % Row 47 \SetRowColor{white} array \seqsplit{array\_values} ( array \$array ) & \seqsplit{array\_values()} returns all the values from the array and indexes the array numerically. & Returns an indexed array of values. \tn % Row Count 29 (+ 7) % Row 48 \SetRowColor{LightBackground} bool \seqsplit{array\_walk\_recursive} ( array \&\$array , callable \$callback {[}, mixed \$userdata = NULL {]} ) & Applies the user-defined callback function to each element of the array. This function will recurse into deeper arrays. & Returns TRUE on success or FALSE on failure. \tn % Row Count 39 (+ 10) \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{17.67cm}{x{5.7358 cm} x{5.5671 cm} x{5.5671 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{17.67cm}}{\bf\textcolor{white}{Array functions (cont)}} \tn % Row 49 \SetRowColor{LightBackground} bool array\_walk ( array \&\$array , callable \$callback {[}, mixed \$userdata = NULL {]} ) & Applies the user-defined callback function to each element of the array array. \seqsplit{array\_walk()} is not affected by the internal array pointer of array. \seqsplit{array\_walk()} will walk through the entire array regardless of pointer position. & Returns TRUE on success or FALSE on failure. \{\{nl\}\}If function callback requires more parameters than given to it, an error of level E\_WARNING will be generated each time \seqsplit{array\_walk()} calls callback. \tn % Row Count 18 (+ 18) % Row 50 \SetRowColor{white} array array ({[} mixed \$... {]} ) & Creates an array. Read the section on the array type for more information on what an array is. & Returns an array of the parameters. The parameters can be given an index with the =\textgreater{} operator. Read the section on the array type for more information on what an array is. \tn % Row Count 32 (+ 14) \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{17.67cm}{x{5.7358 cm} x{5.5671 cm} x{5.5671 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{17.67cm}}{\bf\textcolor{white}{Array functions (cont)}} \tn % Row 51 \SetRowColor{LightBackground} bool arsort ( array \&\$array {[}, int \seqsplit{\$sort\_flags} = \seqsplit{SORT\_REGULAR} {]} ) & This function sorts an array such that array indices maintain their correlation with the array elements they are associated with. This is used mainly when sorting associative arrays where the actual element order is significant. \{\{nl\}\}Note: If two members compare as equal, their relative order in the sorted array is undefined. & Returns TRUE on success or FALSE on failure. \tn % Row Count 26 (+ 26) % Row 52 \SetRowColor{white} bool asort ( array \&\$array {[}, int \seqsplit{\$sort\_flags} = \seqsplit{SORT\_REGULAR} {]} ) & This function sorts an array such that array indices maintain their correlation with the array elements they are associated with. This is used mainly when sorting associative arrays where the actual element order is significant.\{\{nl\}\}Note: If two members compare as equal, their relative order in the sorted array is undefined. & Returns TRUE on success or FALSE on failure. \tn % Row Count 52 (+ 26) \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{17.67cm}{x{5.7358 cm} x{5.5671 cm} x{5.5671 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{17.67cm}}{\bf\textcolor{white}{Array functions (cont)}} \tn % Row 53 \SetRowColor{LightBackground} array compact ( mixed \$varname1 {[}, mixed \$... {]} ) & Creates an array containing variables and their values. For each of these, compact() looks for a variable with that name in the current symbol table and adds it to the output array such that the variable name becomes the key and the contents of the variable become the value for that key. In short, it does the opposite of extract(). Any strings that are not set will simply be skipped. & Returns the output array with all the variables added to it. \tn % Row Count 30 (+ 30) \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{17.67cm}{x{5.7358 cm} x{5.5671 cm} x{5.5671 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{17.67cm}}{\bf\textcolor{white}{Array functions (cont)}} \tn % Row 54 \SetRowColor{LightBackground} int count ( mixed \seqsplit{\$array\_or\_countable} {[}, int \$mode = \seqsplit{COUNT\_NORMAL} {]} ) & Counts all elements in an array, or something in an object. For objects, if you have SPL installed, you can hook into count() by implementing interface Countable. The interface has exactly one method, \seqsplit{Countable::count()}, which returns the return value for the count() function. Please see the Array section of the manual for a detailed explanation of how arrays are implemented and used in PHP. & Returns the number of elements in \seqsplit{array\_or\_countable}. If the parameter is not an array or not an object with implemented Countable interface, 1 will be returned. There is one exception, if \seqsplit{array\_or\_countable} is NULL, 0 will be returned.\{\{nl\}\}Caution count() may return 0 for a variable that isn't set, but it may also return 0 for a variable that has been initialized with an empty array. Use isset() to test if a variable is set. \tn % Row Count 34 (+ 34) \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{17.67cm}{x{5.7358 cm} x{5.5671 cm} x{5.5671 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{17.67cm}}{\bf\textcolor{white}{Array functions (cont)}} \tn % Row 55 \SetRowColor{LightBackground} mixed current ( array \&\$array ) & Every array has an internal pointer to its "current" element, which is initialized to the first element inserted into the array. & The current() function simply returns the value of the array element that's currently being pointed to by the internal pointer. It does not move the pointer in any way. If the internal pointer points beyond the end of the elements list or the array is empty, current() returns FALSE.\{\{nl\}\}Warning This function may return Boolean FALSE, but may also return a non-Boolean value which evaluates to FALSE. Please read the section on Booleans for more information. Use the === operator for testing the return value of this function. \tn % Row Count 41 (+ 41) \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{17.67cm}{x{5.7358 cm} x{5.5671 cm} x{5.5671 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{17.67cm}}{\bf\textcolor{white}{Array functions (cont)}} \tn % Row 56 \SetRowColor{LightBackground} array each ( array \&\$array ) & Return the current key and value pair from an array and advance the array cursor. After each() has executed, the array cursor will be left on the next element of the array, or past the last element if it hits the end of the array. You have to use reset() if you want to traverse the array again using each. & Returns the current key and value pair from the array array. This pair is returned in a four-element array, with the keys 0, 1, key, and value. Elements 0 and key contain the key name of the array element, and 1 and value contain the data. If the internal pointer for the array points past the end of the array contents, each() returns FALSE. \tn % Row Count 27 (+ 27) % Row 57 \SetRowColor{white} mixed end ( array \&\$array ) & end() advances array's internal pointer to the last element, and returns its value. & Returns the value of the last element or FALSE for empty array. \tn % Row Count 34 (+ 7) \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{17.67cm}{x{5.7358 cm} x{5.5671 cm} x{5.5671 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{17.67cm}}{\bf\textcolor{white}{Array functions (cont)}} \tn % Row 58 \SetRowColor{LightBackground} int extract ( array \&\$array {[}, int \$flags = \seqsplit{EXTR\_OVERWRITE} {[}, string \$prefix = NULL {]}{]} ) & Import variables from an array into the current symbol table. Checks each key to see whether it has a valid variable name. It also checks for collisions with existing variables in the symbol table. & Returns the number of variables successfully imported into the symbol table. \tn % Row Count 16 (+ 16) % Row 59 \SetRowColor{white} bool in\_array ( mixed \$needle , array \$haystack {[}, bool \$strict = FALSE {]} ) & Searches haystack for needle using loose comparison unless strict is set. & Returns TRUE if needle is found in the array, FALSE otherwise. \tn % Row Count 22 (+ 6) % Row 60 \SetRowColor{LightBackground} key\_exists & This function is an alias of: \seqsplit{array\_key\_exists()}. & \tn % Row Count 26 (+ 4) % Row 61 \SetRowColor{white} mixed key ( array \&\$array ) & key() returns the index element of the current array position. & The key() function simply returns the key of the array element that's currently being pointed to by the internal pointer. It does not move the pointer in any way. If the internal pointer points beyond the end of the elements list or the array is empty, key() returns NULL. \tn % Row Count 47 (+ 21) \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{17.67cm}{x{5.7358 cm} x{5.5671 cm} x{5.5671 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{17.67cm}}{\bf\textcolor{white}{Array functions (cont)}} \tn % Row 62 \SetRowColor{LightBackground} bool krsort ( array \&\$array {[}, int \seqsplit{\$sort\_flags} = \seqsplit{SORT\_REGULAR} {]} ) & Sorts an array by key in reverse order, maintaining key to data \seqsplit{correlations.} This is useful mainly for associative arrays. & Returns TRUE on success or FALSE on failure. \tn % Row Count 10 (+ 10) % Row 63 \SetRowColor{white} bool ksort ( array \&\$array {[}, int \seqsplit{\$sort\_flags} = \seqsplit{SORT\_REGULAR} {]} ) & Sorts an array by key, maintaining key to data \seqsplit{correlations.} This is useful mainly for associative arrays. & Returns TRUE on success or FALSE on failure. \tn % Row Count 19 (+ 9) % Row 64 \SetRowColor{LightBackground} array list ( mixed \$var1 {[}, mixed \$... {]} ) & Like array(), this is not really a function, but a language construct. list() is used to assign a list of variables in one operation.\{\{nl\}\}Note: list() only works on numerical arrays and assumes the numerical indices start at 0.\{\{nl\}\}Warning In PHP 5, list() assigns the values starting with the right-most parameter. \{\{nl\}\}Warning Modification of the array during list() execution (e.g. using list(\$a, \$b) = \$b) results in undefined behavior. & Returns the assigned array. \tn % Row Count 54 (+ 35) \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{17.67cm}{x{5.7358 cm} x{5.5671 cm} x{5.5671 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{17.67cm}}{\bf\textcolor{white}{Array functions (cont)}} \tn % Row 65 \SetRowColor{LightBackground} bool natcasesort ( array \&\$array ) & \seqsplit{natcasesort()} is a case insensitive version of natsort(). This function implements a sort algorithm that orders alphanumeric strings in the way a human being would while maintaining key/value \seqsplit{associations.} This is described as a "natural ordering". \{\{nl\}\}Note: If two members compare as equal, their relative order in the sorted array is undefined. & Returns TRUE on success or FALSE on failure. \tn % Row Count 27 (+ 27) % Row 66 \SetRowColor{white} bool natsort ( array \&\$array ) & This function implements a sort algorithm that orders alphanumeric strings in the way a human being would while maintaining key/value \seqsplit{associations.} This is described as a "natural ordering". An example of the difference between this algorithm and the regular computer string sorting algorithms (used in sort()) can be seen in the example below.\{\{nl\}\}Note: If two members compare as equal, their relative order in the sorted array is undefined. & Returns TRUE on success or FALSE on failure. \tn % Row Count 62 (+ 35) \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{17.67cm}{x{5.7358 cm} x{5.5671 cm} x{5.5671 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{17.67cm}}{\bf\textcolor{white}{Array functions (cont)}} \tn % Row 67 \SetRowColor{LightBackground} mixed next ( array \&\$array ) & next() behaves like current(), with one difference. It advances the internal array pointer one place forward before returning the element value. That means it returns the next array value and advances the internal array pointer by one. & Returns the array value in the next place that's pointed to by the internal array pointer, or FALSE if there are no more elements.\{\{nl\}\}Warning This function may return Boolean FALSE, but may also return a non-Boolean value which evaluates to FALSE. Please read the section on Booleans for more information. Use the === operator for testing the return value of this function. \tn % Row Count 29 (+ 29) % Row 68 \SetRowColor{white} pos & This function is an alias of: current() & \tn % Row Count 32 (+ 3) \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{17.67cm}{x{5.7358 cm} x{5.5671 cm} x{5.5671 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{17.67cm}}{\bf\textcolor{white}{Array functions (cont)}} \tn % Row 69 \SetRowColor{LightBackground} mixed prev ( array \&\$array ) & Rewind the internal array pointer. prev() behaves just like next(), except it rewinds the internal array pointer one place instead of advancing it. \{\{nl\}\} Note: You won't be able to distinguish the beginning of an array from a boolean FALSE element. To properly traverse an array which may contain FALSE elements, see the each() function. & Returns the array value in the previous place that's pointed to by the internal array pointer, or FALSE if there are no more elements.\{\{nl\}\} Warning This function may return Boolean FALSE, but may also return a non-Boolean value which evaluates to FALSE. Please read the section on Booleans for more information. Use the === operator for testing the return value of this function. \tn % Row Count 30 (+ 30) \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{17.67cm}{x{5.7358 cm} x{5.5671 cm} x{5.5671 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{17.67cm}}{\bf\textcolor{white}{Array functions (cont)}} \tn % Row 70 \SetRowColor{LightBackground} array range ( mixed \$start , mixed \$end {[}, number \$step = 1 {]} ) & Create an array containing a range of elements. & Returns an array of elements from start to end, inclusive. \tn % Row Count 5 (+ 5) % Row 71 \SetRowColor{white} mixed reset ( array \&\$array ) & reset() rewinds array's internal pointer to the first element and returns the value of the first array element. & Returns the value of the first array element, or FALSE if the array is empty. \tn % Row Count 14 (+ 9) % Row 72 \SetRowColor{LightBackground} bool rsort ( array \&\$array {[}, int \seqsplit{\$sort\_flags} = \seqsplit{SORT\_REGULAR} {]} ) & This function sorts an array in reverse order (highest to lowest).\{\{nl\}\}Note: If two members compare as equal, their relative order in the sorted array is undefined. & Returns TRUE on success or FALSE on failure. \tn % Row Count 27 (+ 13) % Row 73 \SetRowColor{white} bool shuffle ( array \&\$array ) & This function shuffles (randomizes the order of the elements in) an array. It uses a pseudo random number generator that is not suitable for \seqsplit{cryptographic} purposes.\{\{nl\}\}Note: If two members compare as equal, their relative order in the sorted array is undefined.\{\{nl\}\}Note: This function assigns new keys to the elements in array. It will remove any existing keys that may have been assigned, rather than just reordering the keys. & Returns TRUE on success or FALSE on failure. \tn % Row Count 61 (+ 34) \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{17.67cm}{x{5.7358 cm} x{5.5671 cm} x{5.5671 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{17.67cm}}{\bf\textcolor{white}{Array functions (cont)}} \tn % Row 74 \SetRowColor{LightBackground} sizeof & This function is an alias of: count(). & \tn % Row Count 3 (+ 3) % Row 75 \SetRowColor{white} bool sort ( array \&\$array {[}, int \seqsplit{\$sort\_flags} = \seqsplit{SORT\_REGULAR} {]} ) & This function sorts an array. Elements will be arranged from lowest to highest when this function has completed.\{\{nl\}\}Note: If two members compare as equal, their relative order in the sorted array is undefined. & Returns TRUE on success or FALSE on failure. \tn % Row Count 20 (+ 17) % Row 76 \SetRowColor{LightBackground} bool uasort ( array \&\$array , callable \seqsplit{\$value\_compare\_func} ) & This function sorts an array such that array indices maintain their correlation with the array elements they are associated with, using a user-defined comparison function. This is used mainly when sorting associative arrays where the actual element order is significant.\{\{nl\}\}Note: If two members compare as equal, their relative order in the sorted array is undefined. & Returns TRUE on success or FALSE on failure. \tn % Row Count 49 (+ 29) \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{17.67cm}{x{5.7358 cm} x{5.5671 cm} x{5.5671 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{17.67cm}}{\bf\textcolor{white}{Array functions (cont)}} \tn % Row 77 \SetRowColor{LightBackground} bool uksort ( array \&\$array , callable \seqsplit{\$key\_compare\_func} ) & uksort() will sort the keys of an array using a \seqsplit{user-supplied} comparison function. If the array you wish to sort needs to be sorted by some non-trivial criteria, you should use this function.\{\{nl\}\}Note: If two members compare as equal, their relative order in the sorted array is undefined. & Returns TRUE on success or FALSE on failure. \tn % Row Count 23 (+ 23) % Row 78 \SetRowColor{white} bool usort ( array \&\$array , callable \seqsplit{\$value\_compare\_func} ) & This function will sort an array by its values using a \seqsplit{user-supplied} comparison function. If the array you wish to sort needs to be sorted by some non-trivial criteria, you should use this function.\{\{nl\}\}Note: If two members compare as equal, their relative order in the sorted array is undefined.\{\{nl\}\}Note: This function assigns new keys to the elements in array. It will remove any existing keys that may have been assigned, rather than just reordering the keys. & Returns TRUE on success or FALSE on failure. \tn % Row Count 59 (+ 36) \hhline{>{\arrayrulecolor{DarkBackground}}---} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{17.67cm}{x{5.8718 cm} x{11.3982 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{17.67cm}}{\bf\textcolor{white}{Array constants}} \tn % Row 0 \SetRowColor{LightBackground} \seqsplit{ARRAY\_FILTER\_USE\_KEY} & pass key as the only argument to callback instead of the value \tn % Row Count 3 (+ 3) % Row 1 \SetRowColor{white} \seqsplit{ARRAY\_FILTER\_USE\_BOTH} & pass both value and key as arguments to callback instead of the value \tn % Row Count 6 (+ 3) % Row 2 \SetRowColor{LightBackground} SORT\_REGULAR & compare items normally (don't change types) \tn % Row Count 8 (+ 2) % Row 3 \SetRowColor{white} SORT\_NUMERIC & compare items numerically \tn % Row Count 9 (+ 1) % Row 4 \SetRowColor{LightBackground} SORT\_STRING & compare items as strings \tn % Row Count 10 (+ 1) % Row 5 \SetRowColor{white} \seqsplit{SORT\_LOCALE\_STRING} & compare items as strings, based on the current locale. It uses the locale, which can be changed using setlocale() \tn % Row Count 15 (+ 5) % Row 6 \SetRowColor{LightBackground} SORT\_NATURAL & compare items as strings using "natural ordering" like natsort() \tn % Row Count 18 (+ 3) % Row 7 \SetRowColor{white} \seqsplit{SORT\_FLAG\_CASE} & can be combined (bitwise OR) with SORT\_STRING or SORT\_NATURAL to sort strings case-insensitively \tn % Row Count 22 (+ 4) % Row 8 \SetRowColor{LightBackground} \seqsplit{EXTR\_OVERWRITE} & If there is a collision, overwrite the existing variable. \tn % Row Count 25 (+ 3) % Row 9 \SetRowColor{white} EXTR\_SKIP & If there is a collision, don't overwrite the existing variable. \tn % Row Count 28 (+ 3) % Row 10 \SetRowColor{LightBackground} \seqsplit{EXTR\_PREFIX\_SAME} & If there is a collision, prefix the variable name with prefix. \tn % Row Count 31 (+ 3) \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{17.67cm}{x{5.8718 cm} x{11.3982 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{17.67cm}}{\bf\textcolor{white}{Array constants (cont)}} \tn % Row 11 \SetRowColor{LightBackground} \seqsplit{EXTR\_PREFIX\_ALL} & Prefix all variable names with prefix. \tn % Row Count 2 (+ 2) % Row 12 \SetRowColor{white} \seqsplit{EXTR\_PREFIX\_INVALID} & Only prefix invalid/numeric variable names with prefix. \tn % Row Count 5 (+ 3) % Row 13 \SetRowColor{LightBackground} \seqsplit{EXTR\_IF\_EXISTS} & Only overwrite the variable if it already exists in the current symbol table, otherwise do nothing. This is useful for defining a list of valid variables and then extracting only those variables you have defined out of \$\_REQUEST, for example. \tn % Row Count 15 (+ 10) % Row 14 \SetRowColor{white} \seqsplit{EXTR\_PREFIX\_IF\_EXISTS} & Only create prefixed variable names if the non-prefixed version of the same variable exists in the current symbol table. \tn % Row Count 20 (+ 5) % Row 15 \SetRowColor{LightBackground} EXTR\_REFS & Extracts variables as references. This effectively means that the values of the imported variables are still referencing the values of the array parameter. You can use this flag on its own or combine it with any other flag by OR'ing the flags. \tn % Row Count 30 (+ 10) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{17.67cm}{x{5.7358 cm} x{5.5671 cm} x{5.5671 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{17.67cm}}{\bf\textcolor{white}{Filesystem Functions}} \tn % Row 0 \SetRowColor{LightBackground} string basename ( string \$path {[}, string \$suffix {]} ) & Given a string containing the path to a file or directory, this function will return the trailing name component. & Returns the base name of the given path. \tn % Row Count 9 (+ 9) % Row 1 \SetRowColor{white} bool chgrp ( string \$filename , mixed \$group ) & Attempts to change the group of the file filename to group. Only the superuser may change the group of a file arbitrarily; other users may change the group of a file to any group of which that user is a member. & Returns TRUE on success or FALSE on failure. \tn % Row Count 26 (+ 17) % Row 2 \SetRowColor{LightBackground} bool chmod ( string \$filename , int \$mode ) & Attempts to change the mode of the specified file to that given in mode. & Returns TRUE on success or FALSE on failure. \tn % Row Count 32 (+ 6) \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{17.67cm}{x{5.7358 cm} x{5.5671 cm} x{5.5671 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{17.67cm}}{\bf\textcolor{white}{Filesystem Functions (cont)}} \tn % Row 3 \SetRowColor{LightBackground} bool chown ( string \$filename , mixed \$user ) & Attempts to change the owner of the file filename to user user. Only the superuser may change the owner of a file. & Returns TRUE on success or FALSE on failure. \tn % Row Count 9 (+ 9) % Row 4 \SetRowColor{white} void \seqsplit{clearstatcache} ({[} bool \seqsplit{\$clear\_realpath\_cache} = false {[}, string \$filename {]}{]} ) & When you use stat(), lstat(), or any of the other functions listed in the affected functions list (below), PHP caches the information those functions return in order to provide faster performance. However, in certain cases, you may want to clear the cached information. For instance, if the same file is being checked multiple times within a single script, and that file is in danger of being removed or changed during that script's operation, you may elect to clear the status cache. In these cases, you can use the \seqsplit{clearstatcache()} function to clear the information that PHP caches about a file. You should also note that PHP doesn't cache information about non-existent files. So, if you call \seqsplit{file\_exists()} on a file that doesn't exist, it will return FALSE until you create the file. If you create the file, it will return TRUE even if you then delete the file. However unlink() clears the cache \seqsplit{automatically}.\{\{nl\}\}Note: This function caches information about specific filenames, so you only need to call \seqsplit{clearstatcache()} if you are performing multiple operations on the same filename and require the information about that particular file to not be cached. & No value is returned. \tn % Row Count 99 (+ 90) \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{17.67cm}{x{5.7358 cm} x{5.5671 cm} x{5.5671 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{17.67cm}}{\bf\textcolor{white}{Filesystem Functions (cont)}} \tn % Row 5 \SetRowColor{LightBackground} bool copy ( string \$source , string \$dest {[}, resource \$context {]} ) & Makes a copy of the file source to dest. If you wish to move a file, use the rename() function. & Returns TRUE on success or FALSE on failure. \tn % Row Count 8 (+ 8) % Row 6 \SetRowColor{white} delete & This is a dummy manual entry to satisfy those people who are looking for unlink() or unset() in the wrong place. & \tn % Row Count 17 (+ 9) % Row 7 \SetRowColor{LightBackground} string dirname ( string \$path {[}, int \$levels = 1 {]} ) & Given a string containing the path of a file or directory, this function will return the parent directory's path that is levels up from the current directory. & Returns the path of a parent directory. If there are no slashes in path, a dot ('.') is returned, indicating the current directory. Otherwise, the returned string is path with any trailing /component removed. \tn % Row Count 33 (+ 16) \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{17.67cm}{x{5.7358 cm} x{5.5671 cm} x{5.5671 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{17.67cm}}{\bf\textcolor{white}{Filesystem Functions (cont)}} \tn % Row 8 \SetRowColor{LightBackground} float \seqsplit{disk\_free\_space} ( string \$directory ) & Given a string containing a directory, this function will return the number of bytes available on the \seqsplit{corresponding} filesystem or disk partition. & Returns the number of available bytes as a float or FALSE on failure. \tn % Row Count 12 (+ 12) % Row 9 \SetRowColor{white} float \seqsplit{disk\_total\_space} ( string \$directory ) & Given a string containing a directory, this function will return the total number of bytes on the \seqsplit{corresponding} filesystem or disk partition. & Returns the total number of bytes as a float or FALSE on failure. \tn % Row Count 23 (+ 11) % Row 10 \SetRowColor{LightBackground} \seqsplit{diskfreespace} & This function is an alias of: \seqsplit{disk\_free\_space()}. & \tn % Row Count 27 (+ 4) % Row 11 \SetRowColor{white} bool fclose ( resource \$handle ) & The file pointed to by handle is closed. & Returns TRUE on success or FALSE on failure. \tn % Row Count 31 (+ 4) \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{17.67cm}{x{5.7358 cm} x{5.5671 cm} x{5.5671 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{17.67cm}}{\bf\textcolor{white}{Filesystem Functions (cont)}} \tn % Row 12 \SetRowColor{LightBackground} bool feof ( resource \$handle ) & Tests for end-of-file on a file pointer. & Returns TRUE if the file pointer is at EOF or an error occurs (including socket timeout); otherwise returns FALSE. \tn % Row Count 9 (+ 9) % Row 13 \SetRowColor{white} bool fflush ( resource \$handle ) & This function forces a write of all buffered output to the resource pointed to by the file handle. & Returns TRUE on success or FALSE on failure. \tn % Row Count 17 (+ 8) % Row 14 \SetRowColor{LightBackground} string fgetc ( resource \$handle ) & Gets a character from the given file pointer. & Returns a string containing a single character read from the file pointed to by handle. Returns FALSE on EOF.\{\{nl\}\}Warning This function may return Boolean FALSE, but may also return a non-Boolean value which evaluates to FALSE. Please read the section on Booleans for more information. Use the === operator for testing the return value of this function. \tn % Row Count 45 (+ 28) \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{17.67cm}{x{5.7358 cm} x{5.5671 cm} x{5.5671 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{17.67cm}}{\bf\textcolor{white}{Filesystem Functions (cont)}} \tn % Row 15 \SetRowColor{LightBackground} array fgetcsv ( resource \$handle {[}, int \$length = 0 {[}, string \$delimiter = "," {[}, string \$enclosure = '"' {[}, string \$escape = "\textbackslash{}" {]}{]}{]}{]} ) & Similar to fgets() except that fgetcsv() parses the line it reads for fields in CSV format and returns an array containing the fields read. & Returns an indexed array containing the fields read.\{\{nl\}\}Note: A blank line in a CSV file will be returned as an array comprising a single null field, and will not be treated as an error.\{\{nl\}\}Note: If PHP is not properly recognizing the line endings when reading files either on or created by a Macintosh computer, enabling the \seqsplit{auto\_detect\_line\_endings} run-time \seqsplit{configuration} option may help resolve the problem.\{\{nl\}\}fgetcsv() returns NULL if an invalid handle is supplied or FALSE on other errors, including end of file. \tn % Row Count 41 (+ 41) \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{17.67cm}{x{5.7358 cm} x{5.5671 cm} x{5.5671 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{17.67cm}}{\bf\textcolor{white}{Filesystem Functions (cont)}} \tn % Row 16 \SetRowColor{LightBackground} string fgets ( resource \$handle {[}, int \$length {]} ) & Gets a line from file pointer. & Returns a string of up to length - 1 bytes read from the file pointed to by handle. If there is no more data to read in the file pointer, then FALSE is returned. If an error occurs, FALSE is returned. \tn % Row Count 16 (+ 16) % Row 17 \SetRowColor{white} string fgetss ( resource \$handle {[}, int \$length {[}, string \seqsplit{\$allowable\_tags} {]}{]} ) & Identical to fgets(), except that fgetss() attempts to strip any NUL bytes, HTML and PHP tags from the text it reads. & Returns a string of up to length - 1 bytes read from the file pointed to by handle, with all HTML and PHP code stripped. If an error occurs, returns FALSE. \tn % Row Count 28 (+ 12) % Row 18 \SetRowColor{LightBackground} bool file\_exists ( string \$filename ) & Checks whether a file or directory exists. & Returns TRUE if the file or directory specified by filename exists; FALSE otherwise. \{\{nl\}\} Note: This function will return FALSE for symlinks pointing to non-existing files. \tn % Row Count 42 (+ 14) \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{17.67cm}{x{5.7358 cm} x{5.5671 cm} x{5.5671 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{17.67cm}}{\bf\textcolor{white}{Filesystem Functions (cont)}} \tn % Row 19 \SetRowColor{LightBackground} string \seqsplit{file\_get\_contents} ( string \$filename {[}, bool \seqsplit{\$use\_include\_path} = false {[}, resource \$context {[}, int \$offset = 0 {[}, int \$maxlen {]}{]}{]}{]} ) & This function is similar to file(), except that \seqsplit{file\_get\_contents()} returns the file in a string, starting at the specified offset up to maxlen bytes. On failure, \seqsplit{file\_get\_contents()} will return FALSE. \seqsplit{file\_get\_contents()} is the preferred way to read the contents of a file into a string. It will use memory mapping techniques if supported by your OS to enhance performance.\{\{nl\}\}Note: If you're opening a URI with special characters, such as spaces, you need to encode the URI with urlencode(). & The function returns the read data or FALSE on failure.\{\{nl\}\}Warning This function may return Boolean FALSE, but may also return a non-Boolean value which evaluates to FALSE. Please read the section on Booleans for more information. Use the === operator for testing the return value of this function.\{\{nl\}\}An E\_WARNING level error is generated if filename cannot be found, maxlength is less than zero, or if seeking to the specified offset in the stream fails. \tn % Row Count 39 (+ 39) \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{17.67cm}{x{5.7358 cm} x{5.5671 cm} x{5.5671 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{17.67cm}}{\bf\textcolor{white}{Filesystem Functions (cont)}} \tn % Row 20 \SetRowColor{LightBackground} int \seqsplit{file\_put\_contents} ( string \$filename , mixed \$data {[}, int \$flags = 0 {[}, resource \$context {]}{]} ) & This function is identical to calling fopen(), fwrite() and fclose() successively to write data to a file. If filename does not exist, the file is created. Otherwise, the existing file is overwritten, unless the FILE\_APPEND flag is set. & This function returns the number of bytes that were written to the file, or FALSE on failure.\{\{nl\}\}Warning This function may return Boolean FALSE, but may also return a non-Boolean value which evaluates to FALSE. Please read the section on Booleans for more information. Use the === operator for testing the return value of this function. \tn % Row Count 26 (+ 26) \hhline{>{\arrayrulecolor{DarkBackground}}---} \end{tabularx} \par\addvspace{1.3em} \end{document}