PHP Cheat Sheet 2026
The 30 highest-yield PHP facts, distilled from real exam questions. Print it, save it as a PDF, or study it here — free, no sign-up.
70 questions
90 min time limit
70.00% to pass
- What does the abstract keyword mean when applied to a PHP class? → The class cannot be instantiated directly
- Isn't it true/false that all variables in PHP begin with a $(dollar) sign? → B) True
- Which PHP magic method defines how an object behaves when cast to a string? → __toString()
- Is it possible to run PHP from the command line? → Yes
- Which superglobal holds data submitted via an HTML form using the POST method? → $_POST
- What is the primary value of case study analysis in PHP Programming Language training? → Developing critical thinking by applying theory to realistic professional scenarios
- What is the recommended technique for preventing CSRF attacks in PHP form submissions? → Generate and validate unique per-session CSRF tokens in every form
- Which loop in PHP is guaranteed to execute its body at least once? → do-while
- Is it true/false that once a variable is declared, it can only be used once in the PHP source code? → A) False
- What does PDO::rollBack() do in PHP? → Undoes all changes made since the transaction began
- What is a risk mitigation strategy in PHP Programming Language practice? → Implementing controls that reduce the likelihood or impact of identified risks
- Which keyword is used to define a class in PHP? → class
- What does PDOStatement::rowCount() return after a SELECT query in most databases? → An unpredictable or zero value (behavior varies by driver)
- Which PHP session configuration setting helps mitigate session hijacking via XSS attacks? → session.cookie_httponly = 1
- What is late static binding in PHP accessed through? → static::
- To create a CURL session, which of the following functions will be used? → Curl_init()
- Which keyword allows calling a PHP method without creating a class instance? → static
- How do PHP professionals build trust with clients or stakeholders? → Through consistent competence, transparency, reliability, and ethical behavior
- Which function will you use to quickly transform an HTML page into a database-friendly format? → Htmlentities()
- PHP 5.3.0 introduces a new functionality that allows you to refer to a called class in a static inheritance context. What's the name of it? → Late static bindings
- What is the benefit of interdisciplinary collaboration in PHP Programming Language practice? → It brings diverse expertise and perspectives that improve outcomes and innovation
- What is the name of the special method automatically called when an object is created in PHP? → __construct()
- How do PHP professionals evaluate research quality? → By assessing methodology, sample size, peer review status, and relevance to practice
- What does an interface in PHP define? → A contract of methods that implementing classes must define
- Which PDO method binds a PHP variable to a named placeholder, passing by reference? → bindParam()
- Which of the following methods for declaring a PHP variable is incorrect? → $a_Number = 9
- The syntax of PHP is most similar to: → Perl and C
- What is the purpose of PHP's filter_var() and filter_input() functions in secure development? → To validate and sanitize user input using predefined filter constants
- What data type will PHP convert the following variable to automatically:? $aVariable = 99; → B) Integer (a number variable)
- Which PHP function converts special characters to HTML entities to prevent XSS attacks? → htmlspecialchars()
Turn these facts into recall: