\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{Lilava} \pdfinfo{ /Title (mix-php-1.pdf) /Creator (Cheatography) /Author (Lilava) /Subject (Mix PHP 1 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}{A3379C} \definecolor{LightBackground}{HTML}{F9F2F8} \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{Mix PHP 1 Cheat Sheet}}}} \\ \normalsize{by \textcolor{DarkBackground}{Lilava} via \textcolor{DarkBackground}{\uline{cheatography.com/64138/cs/16320/}}} \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}Lilava \\ \uline{cheatography.com/lilava} \\ \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 12th July, 2018.\\ 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}{Stream Context}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{Which of the following is true about stream contexts? (Choose 2) \newline % Row Count 2 (+ 2) A. A context can modify or enhance the behavior of a stream \newline % Row Count 4 (+ 2) B. A context indicates what session the stream is part of \newline % Row Count 6 (+ 2) C. A context is a set of parameters and stream wrapper specific options \newline % Row Count 8 (+ 2) D. Contexts are created with new Stream\_Context();% Row Count 10 (+ 2) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Answer: A, C} \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}{stream}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{Which of the following will set a 10 seconds read timeout for a stream? \newline % Row Count 2 (+ 2) A. \seqsplit{ini\_set("default\_socket\_timeout"}, 10); \newline % Row Count 4 (+ 2) B. \seqsplit{stream\_read\_timeout(\$stream}, 10); \newline % Row Count 5 (+ 1) C. Specify the timeout as the 5th parameter to the fsockopen() function used to open a stream \newline % Row Count 7 (+ 2) D. \seqsplit{stream\_set\_timeout(\$stream}, 10); \newline % Row Count 8 (+ 1) E. None of the above% Row Count 9 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Answer: D} \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}{PUT method}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{When uploading a file to a PHP script using the HTTP PUT method, where would the file \newline % Row Count 2 (+ 2) data be found? \newline % Row Count 3 (+ 1) A. the \$\_FILES super-global \newline % Row Count 4 (+ 1) B. the input stream php://input \newline % Row Count 5 (+ 1) C. the \$\_POST super-global \newline % Row Count 6 (+ 1) D. the global variable scope% Row Count 7 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Answer: B} \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}{Methods}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{What is the name of the method that can be used to provide read access to virtual properties in a class? \newline % Row Count 3 (+ 3) A. \_\_call() \newline % Row Count 4 (+ 1) B. \_\_get() \newline % Row Count 5 (+ 1) C. \_\_set() \newline % Row Count 6 (+ 1) D. \_\_wakeup() \newline % Row Count 7 (+ 1) E. \_\_fetch()% Row Count 8 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{B - method \_\_get()} \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}{Methods}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{Which of the following tasks can be achieved by using magic methods? (Choose 3) \newline % Row Count 2 (+ 2) A. Initializing or uninitializing object data \newline % Row Count 4 (+ 2) B. Creating a new stream wrapper \newline % Row Count 5 (+ 1) C. Creating an iterable object \newline % Row Count 6 (+ 1) D. Processing access to undefined methods or properties \newline % Row Count 8 (+ 2) E. Overloading operators like +, *, etc. \newline % Row Count 9 (+ 1) F. Converting objects to string representation% Row Count 10 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Answer : A,D,F} \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}{Methods}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{Which of the following methods are available to limit the amount of resources available to \newline % Row Count 2 (+ 2) PHP through php.ini? (Choose 2) \newline % Row Count 3 (+ 1) A. Limit the amount of memory a script can consume \newline % Row Count 5 (+ 2) B. Limit the total amount of memory PHP uses on the entire server \newline % Row Count 7 (+ 2) C. Limit the maximum execution time of a script \newline % Row Count 8 (+ 1) D. Limit the maximum number of concurrent PHP processes \newline % Row Count 10 (+ 2) E. Limit the maximum number of concurrent PHP threads% Row Count 12 (+ 2) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Answer: A, C} \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}{Methods}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{Which methods can be used to overload object properties? (Choose 2) \newline % Row Count 2 (+ 2) A. set(), get() \newline % Row Count 3 (+ 1) B. \_\_set(), \_\_get() \newline % Row Count 4 (+ 1) C. \_\_put(), \_\_receive(), \_\_exists() \newline % Row Count 5 (+ 1) D. set(), get(), isset() \newline % Row Count 6 (+ 1) E. \_\_isset(), \_\_unset()% Row Count 7 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Answer : B,E} \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}{key}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{What is the name of the key in \$\_FILES{[}'name'{]} that contains the number of bytes of the uploaded file?% Row Count 3 (+ 3) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Answer: size} \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}{uploads}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{Your application uses PHP to accept and process file uploads. It fails to upload a file that is \newline % Row Count 2 (+ 2) 5 MB in size, although upload\_max\_filesize is set to "10M". Which of the following configurations could be responsible for this outcome? (Choose 2) \newline % Row Count 6 (+ 4) A. The PHP configuration option post\_max\_size is set to a value that is too small \newline % Row Count 8 (+ 2) B. The web server is using an incorrect encoding as part of the HTTP response sent to the client \newline % Row Count 10 (+ 2) C. The browser uses an incorrect encoding as part of the HTTP request sent to the server \newline % Row Count 12 (+ 2) D. The hidden form field MAX\_FILE\_SIZE was set to a value that is too small \newline % Row Count 14 (+ 2) E. PHP cannot process file uploads larger than 4 MB% Row Count 16 (+ 2) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Answer: A, D} \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}{object storage}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{In order to create an object storage where each object would be stored only once, you may use which of the following? (choose 2) \newline % Row Count 3 (+ 3) A. SplFixedArray \newline % Row Count 4 (+ 1) B. SplObjectStorage \newline % Row Count 5 (+ 1) C. SplString \newline % Row Count 6 (+ 1) D . spl\_object\_hash \newline % Row Count 7 (+ 1) E. spl\_same\_object% Row Count 8 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Answer: B, D} \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}{Joins}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{Which technique should be used to speed up joins without changing their results? \newline % Row Count 2 (+ 2) A. Add indices on joined columns \newline % Row Count 3 (+ 1) B. Add a WHERE clause \newline % Row Count 4 (+ 1) C. Add a LIMIT clause \newline % Row Count 5 (+ 1) D. Use an inner join% Row Count 6 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Answer: A} \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}{content-type}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{What content-type is required when sending an HTTP POST using JavaScript to ensure that PHP can access the data? \newline % Row Count 3 (+ 3) A. \seqsplit{application/x-www-form-urlencoded} \newline % Row Count 5 (+ 2) B. http/post \newline % Row Count 6 (+ 1) C. text/html \newline % Row Count 7 (+ 1) D. \seqsplit{object/multipart-formdata}% Row Count 8 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Answer : A} \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}{indetifiers}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{Which of the following are valid identifiers? \newline % Row Count 1 (+ 1) A. function 4You()\{\} \newline % Row Count 2 (+ 1) B. function \_4You()\{\} \newline % Row Count 3 (+ 1) C. function object()\{\} \newline % Row Count 4 (+ 1) D. \$1 = "Hello"; \newline % Row Count 5 (+ 1) E. \$\_1 = "Hello World";% Row Count 6 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Answer : B, C , E} \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}{traits}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{Which of the following is NOT true about PHP traits? (Choose 2) \newline % Row Count 2 (+ 2) A. Multiple traits can be used by a single class. \newline % Row Count 3 (+ 1) B. A trait can implement an interface. \newline % Row Count 4 (+ 1) C. A trait can declare a private variable. \newline % Row Count 5 (+ 1) D. Traits are able to be auto-loaded. \newline % Row Count 6 (+ 1) E. Traits automatically resolve conflicts based on definition order.% Row Count 8 (+ 2) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Answer: B, E} \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}{expressions}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{Which of the following expressions will evaluate to a random value from an array below? \newline % Row Count 2 (+ 2) \$array = array("Sue","Mary","John","Anna"); \newline % Row Count 4 (+ 2) A. array\_rand(\$array); \newline % Row Count 5 (+ 1) B. array\_rand(\$array, 1); \newline % Row Count 6 (+ 1) C. shuffle(\$array); \newline % Row Count 7 (+ 1) D. \$array{[}array\_rand(\$array){]}; \newline % Row Count 8 (+ 1) E. array\_values(\$array, ARRAY\_RANDOM);% Row Count 9 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Answer: D} \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}{exceptions}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{What exception type will catch the error raised by the expression 2 / 0? \newline % Row Count 2 (+ 2) A. LogicException \newline % Row Count 3 (+ 1) B. RangeException \newline % Row Count 4 (+ 1) C. DivisionByZeroError \newline % Row Count 5 (+ 1) D. ArithmeticError% Row Count 6 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Answer: C} \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}{exceptions}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{Which of the following statements about exceptions is correct? (Choose 2) \newline % Row Count 2 (+ 2) A. you can only throw classes derived from Exception \newline % Row Count 4 (+ 2) B. a try block can have multiple catch blocks \newline % Row Count 5 (+ 1) C. a try block must not be followed by a catch block \newline % Row Count 7 (+ 2) D. try blocks cannot contain nested try blocks% Row Count 8 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Answer: A, B} \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}{exceptions}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{Which of the following statements about exceptions is correct? (Choose 2) \newline % Row Count 2 (+ 2) A. you can only throw classes derived from Exception \newline % Row Count 4 (+ 2) B. a try block can have multiple catch blocks \newline % Row Count 5 (+ 1) C. a try block must not be followed by a catch block \newline % Row Count 7 (+ 2) D. try blocks cannot contain nested try blocks% Row Count 8 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Answer: A, B} \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{white} \mymulticolumn{1}{x{5.377cm}}{Which sentence describes the following regular expression match? \newline % Row Count 2 (+ 2) preg\_match('/\textasciicircum{}\textbackslash{}d+(?:\textbackslash{}.{[}0-9{]}+)?\$/', \$test); \newline % Row Count 4 (+ 2) A. It matches float numbers with thousand seperators. \newline % Row Count 6 (+ 2) B. It matches float numbers without thousand seperators. \newline % Row Count 8 (+ 2) C. It matches binary integer numbers. \newline % Row Count 9 (+ 1) D. It matches any string. \newline % Row Count 10 (+ 1) E. It does not match anything% Row Count 11 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Answer: B} \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{white} \mymulticolumn{1}{x{5.377cm}}{Which parts of the text are matched in the following regular expression? \newline % Row Count 2 (+ 2) \$text = \textless{}\textless{}\textless{}EOT \newline % Row Count 3 (+ 1) The big bang bonged under the bung. \newline % Row Count 4 (+ 1) EOT; \newline % Row Count 5 (+ 1) \seqsplit{preg\_match\_all('@b.n?g@'}, \$text, \$matches); \newline % Row Count 7 (+ 2) A. bang bong bung \newline % Row Count 8 (+ 1) B. bang bonged bung \newline % Row Count 9 (+ 1) C. big bang bong bung \newline % Row Count 10 (+ 1) D. big bang bung% Row Count 11 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Answer: C} \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{white} \mymulticolumn{1}{x{5.377cm}}{How many elements does the \$matches array contain after the following function call is performed? preg\_match('/\textasciicircum{}(\textbackslash{}d\{1,2\}({[}a-z{]}+))(?:\textbackslash{}s*)\textbackslash{}S+ (?=201{[}0-9{]})/', '21st March 2014', \$matches); \newline % Row Count 5 (+ 5) A. 1 \newline % Row Count 6 (+ 1) B. 2 \newline % Row Count 7 (+ 1) C. 3 \newline % Row Count 8 (+ 1) D. 4% Row Count 9 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Answer: C} \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}{Headers}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{Under what condition may HTTP headers be set from PHP if there content echoed prior to the header function being used? \newline % Row Count 3 (+ 3) A. headers\_sent() returns true \newline % Row Count 4 (+ 1) B. Output buffering is enabled \newline % Row Count 5 (+ 1) C. The client supports local buffering \newline % Row Count 6 (+ 1) D. The webserver uses preemptive mode% Row Count 7 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Answer: B} \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}{Headers}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{Before the headers are sent, how can you remove a previously set header? \newline % Row Count 2 (+ 2) A. Use the header\_remove() function, providing the name of the header \newline % Row Count 4 (+ 2) B. Use the die() function to abort the PHP script \newline % Row Count 5 (+ 1) C. Not possible \newline % Row Count 6 (+ 1) D. Use the headers\_list() function, providing the name of the header as the second argument% Row Count 8 (+ 2) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Answer: A} \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}{Headers}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{From your PHP application, how can you send the same header twice, but with different values? \newline % Row Count 2 (+ 2) A. Set the second argument of the header() function to false \newline % Row Count 4 (+ 2) B. PHP does that automatically \newline % Row Count 5 (+ 1) C. You may only send a particular type of header once \newline % Row Count 7 (+ 2) D. Use the header\_add() function% Row Count 8 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Answer: A} \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}{type hinting}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{Type hinting in PHP allows the identification of the following variable types : (choose 2) \newline % Row Count 2 (+ 2) A. String \newline % Row Count 3 (+ 1) B. Integer \newline % Row Count 4 (+ 1) C. Array \newline % Row Count 5 (+ 1) D. Any class or interface type \newline % Row Count 6 (+ 1) E. All of the above% Row Count 7 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Answer : C, D} \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}{type hinting}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{Which of the following statements is NOT correct? \newline % Row Count 1 (+ 1) A. Only methods can have type hints \newline % Row Count 2 (+ 1) B. Typehints can be optional \newline % Row Count 3 (+ 1) C. Typehints can be references% Row Count 4 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Answer: A} \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}{reflection}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{Which of the following is NOT possible using reflection? \newline % Row Count 2 (+ 2) A. Analysing of nearly any aspect of classes and interfaces \newline % Row Count 4 (+ 2) B. Analysing of nearly any aspect of functions \newline % Row Count 5 (+ 1) C. Adding class methods \newline % Row Count 6 (+ 1) D. Implement dynamic construction (new with a variable class name)% Row Count 8 (+ 2) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Answer: C} \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}{reflection}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{Which of the following statements about reflection is correct? \newline % Row Count 2 (+ 2) A. Reflection is an extension that can be disabled \newline % Row Count 4 (+ 2) B. Reflection is a new extension present only in PHP7.0+ \newline % Row Count 6 (+ 2) C. Reflection only allows to reflect on built-in classes \newline % Row Count 8 (+ 2) D. Built-in classes can be reflected on command line using php -{}-rc \<classname\textgreater{}% Row Count 10 (+ 2) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Answer : D} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} % That's all folks \end{multicols*} \end{document}