200-710 Exam Questions
231 real 200-710 exam questions with expert-verified answers and explanations. Page 1 of 5.
- Question #1Strings & Patterns
What is the difference between the spaceship operator (<=>) and the strcmp() function?
spaceship operatorstrcmpstring comparisonreturn values - Question #2Error Handling
Which of these error types may be handled by a user defined error handler function? (Choose two.)
error typesset_error_handlerE_NOTICEE_WARNING - Question #3Strings & Patterns
What is the output of the following code? $string = 'Good luck!'; $start = 10; var_dump(substr($string, $start, $start));
substrstring indexingedge casesstring functions - Question #4State Management
Consider 3 PHP files that are called asynchronously via XMLHttpRequest: // s1.php session_start(); sleep(1); // s2.php session_start(); sleep(2); // s3.php session_start(); sleep(3...
session lockingconcurrent requestsXMLHttpRequestsession_start - Question #5Object-Oriented Programming
What is the output of the following code? class Test { public $var = 1; } function addMe (Test $t) { $t->var++; } $t = new Test(); addMe($t); echo $t->var;
object passingpass by handleclass propertiesmethod parameters - Question #6Databases & SQL
What is the benefit of using persistent database connections in PHP? (Choose two.)
persistent connectionsconnection overheadpconnectdatabase - Question #7Namespaces
What is the output of the following code? namespace MyNamespace; class Test { } echo Test::class;
::class constantnamespace resolutionclass namesfully qualified name - Question #8Strings & Patterns
What function is best suited for extracting data from a formatted string into an array?
sscanfstring parsingformatted stringsarray extraction - Question #9Error Handling
What exception type will catch the error raised by the expression 2 / 0?
DivisionByZeroErrorexception hierarchyarithmetic errorserror types - Question #10PHP Basics
What is the output of the following code? echo '1' . (print '2') + 3;
operator precedenceprint return valueconcatenationtype coercion - Question #11PHP Basics
What is the output of the following code? $a = 3; switch ($a) { case 1: echo 'one'; break; case 2: echo 'two'; break; default: echo 'four'; break; case 3: echo 'three'; break; }
switch statementdefault casecase orderingcontrol flow - Question #12Object-Oriented Programming
What is "instanceof" an example of?
instanceofoperatorstype checkingkeywords - Question #13PHP Basics
Which of the following may be used in conjunction with CASE inside a SWITCH statement?
switch statementcase valuesexpressionscontrol flow - Question #14PHP Basics
What is the output of the following code? $a = 'a', $b = 'b'; echo isset($c) ? $a.$b.$c : ($c = 'c').'d';
ternary operatorissetvariable assignmentstring concatenation - Question #15PHP Basics
Which of the following are valid identifiers? (Choose 3)
identifiersnaming rulesvariable namesfunction names - Question #16Web Features
What super-global should be used to access information about uploaded files via a POST request?
$_FILESfile uploadsuperglobalsHTTP POST - Question #17PHP Basics
What is the difference between "print" and "echo"?
printechooutput functionsreturn value - Question #18PHP Basics
What is the result of the following bitwise operation in PHP? 1 ^ 2
bitwise XORbinary operatorsbitwise arithmeticoperators - Question #19Data Formats & Types
What is the output of the following code? echo "22" + "0.2", 23 . 1;
type jugglingstring arithmeticconcatenationnumber conversion - Question #20PHP Basics
What is the output of the following code? $first = "second"; $second = "first"; echo $$$first;
variable variablesdynamic variablesvariable indirection$$ - Question #21I/O
Which of the following will set a 10 seconds read timeout for a stream?
stream timeoutstream_set_timeoutsocket streamsI/O functions - Question #22I/O
What function allows resizing of PHP's file write buffer?
write bufferstream_set_write_bufferoutput bufferingI/O functions - Question #23PHP Basics
What does the __FILE__ constant contain?
magic constants__FILE__script pathpredefined constants - Question #24I/O
What can prevent PHP from being able to open a file on the hard drive (Choose 2)?
file permissionsopen_basedirfile access restrictionssecurity directives - Question #25Namespaces
What purpose do namespaces fulfill?
namespace purposeencapsulationsymbol collisioncode organization - Question #26Namespaces
When would you use classes and when would you use namespaces?
namespaces vs classesencapsulationname collisioncode organization - Question #27Namespaces
Which of these elements can be encapsulated by namespaces and made accessible from the outside?
namespace membersclassesfunctionsconstants - Question #28Namespaces
You'd like to use the class MyDBConnection that's defined in the MyGreatFramework\MyGreatDatabaseAbstractionLayer namespace, but you want to minimize "as much as possible" the leng...
namespace aliasinguse statementclass importfully qualified name - Question #29Error Handling
How should you track errors on your production website?
error logginglog_errorsproduction error trackingdisplay_errors - Question #30Namespaces
What would be the output of the following code? namespace MyFramework\DB; class MyClass { static function myName() { return __METHOD__; } } print MyClass::myName();
__METHOD__magic constantsnamespace-qualified namesstatic methods - Question #31PHP Basics
Which of the following methods are available to limit the amount of resources available to PHP through php.ini? (Choose 2)
memory_limitmax_execution_timephp.iniresource limits - Question #32Namespaces
Consider the following two files. When you run test.php, what would the output look like? test.php: include "MyString.php"; print ", "; print strlen("Hello world!"); MyString.php:...
namespace function resolutionglobal fallbackfunction shadowingnamespace scope - Question #33Closures
Which line of code can be used to replace the INSERT comment in order to output "hello"? class C { public $ello = 'ello'; public $j; public $m; function __construct($y) { $this->c...
static closuresclosure bindingcallable variablesanonymous functions - Question #34Closures
What is the output of the following code? function z($x) { return function_ ($y) use ($x) { return str_repeat($y, $x); }; } $a = z(2); $b = z(3); echo $a(3) . $b(2);
closure usecurryingstr_repeathigher-order functions - Question #35Closures
What is the output of the following code? $f = function () { return "hello"; }; echo gettype($f);
gettypeclosure typeobject typeanonymous functions - Question #36Magic Methods and Traits
What is the output of the following code? class C { public $x = 1; function __construct() { ++$this->x; } function __invoke() { return ++$this->x; } function __toString() { return...
__invoke__construct__toStringmagic method order - Question #37Arrays
Which SPL class implements fixed-size storage?
SplFixedArraySPLfixed-size storagedata structures - Question #38Arrays
In order to create an object storage where each object would be stored only once, you may use which of the following? (Choose 2) A. SplFixedArray B. SplObjectStorage C. SplString D...
SplObjectStoragespl_object_hashobject uniquenessSPL data structures - Question #39Object-Oriented Programming
What is the output of the following code? class Base { protected static function whoami() { echo "Base "; } public static function whoareyou() { static::whoami(); } } public static...
late static bindingstatic::self::inheritance method resolution - Question #40Object-Oriented Programming
Late static binding is used in PHP to:
late static bindingstatic::caller classstatic method calls - Question #41Magic Methods and Traits
What is the output of the following code? class Test { public function __call($name, $args) { call_user_func_array('static::' . $name . '__testName', $args); echo "$1, "; } public...
__callcall_user_func_arraystatic methodsinheritance - Question #42Magic Methods and Traits
Which of the following tasks can be achieved by using magic methods? (Choose 3) A. Initializing or uninitializing object data B. Creating a new stream wrapper C. Creating an iterab...
magic methods__construct__destruct__call - Question #43Magic Methods and Traits
How should class MyObject be defined for the following code to work properly? Assume $array is an array and MyObject is a user-defined class. $obj = new MyObject(); array_walk($arr...
__invokecallablearray_walkmagic methods - Question #44Magic Methods and Traits
Consider the following code. What change must be made to the class for the code to work as written? class Magic { protected $v = array("a" => 1, "b" => 2, "c" => 3); public functio...
__get__setproperty overloadingmagic methods - Question #45Magic Methods and Traits
SimpleXML provides the ability to iterate over items in an XML document, as well as access items within it as if they were object properties. When creating your own classes to acce...
__toStringIteratorArrayAccessobject access - Question #46I/O
Which of the following is used to find all PHP files under a certain directory?
RecursiveDirectoryIteratordirectory traversalSPLiterators - Question #47Web Features
Which PHP function is used to validate whether the contents of $_FILES['name']['tmp_name'] have really been uploaded via HTTP?
is_uploaded_filefile upload$_FILESsecurity - Question #48Web Features
Which PHP function is used to validate whether the contents of $_FILES['name']['tmp_name'] have really been uploaded via HTTP, and also save the contents into another folder?
move_uploaded_filefile upload$_FILES - Question #49Web Features
What is the name of the key for the element in $_FILES['name'] that contains the provisional name of the uploaded file?
$_FILEStmp_namefile upload - Question #50Security
What information can be used to reliably determine the type of an uploaded file?
file type detectionMIME typefile contentssecurity