Which string will be returned by the following function call?
$test = '/etc/conf.d/wireless';
substr($test, strrpos($test, '/')); // note that strrpos() is being called, and not strpos()
Which of the following expressions will evaluate to a random value from an array below?
$array = array("Sue","Mary","John","Anna");
How can a SimpleXML object be converted to a DOM object?
Which of the following are NOT acceptable ways to create a secure password hash in PHP? (Choose 2)
Which of the following can be registered as entry points with a SoapServer instance (choose 2):
Which of the following is an invalid DOM save method?
Which of the following is correct? (Choose 2)
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);
Which of the following PHP functions can be used to set the HTTP response code? (Choose 2)
What will be the result of the following operation?
$a = array_merge([1,2,3] + [4=>1,5,6]);
echo $a[2];
What is the output of the following code?
var_dump(boolval([]));
In a shared hosting environment, session data can be read by PHP scripts written by any user. How can you prevent this? (Choose 2)
What function can be used to retrieve an array of current options for a stream context?
Which of the following PHP values may NOT be encoded to a JavaScript literal using PHP's ext/json capabilities?
What DOMElement method should be used to check for availability of a non-namespaced attribute?
Which elements does the array returned by the function pathinfo() contain?
What is the name of the key in $_FILES['name'] that contains the number of bytes of the uploaded file?
Which of the following statements about exceptions is correct? (Choose 2)
Which SPL class implements fixed-size storage?
Which of the following methods are available to limit the amount of resources available to PHP through php.ini? (Choose 2)
In order to create an object storage where each object would be stored only once, you may use which of the following? (Choose 2)
What will the $array array contain at the end of this script?
function modifyArray (&$array)
{
foreach ($array as &$value)
{
$value = $value + 1;
}
$value = $value + 2;
}
$array = array (1, 2, 3);
modifyArray($array);
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 function __get($v) {
return $this->v[$v];
}
}
$m = new Magic();
$m->d[] = 4;
echo $m->d[0];
What is the name of the header used to require HTTP authentication?
What is the preferred method for preventing SQL injection?
Which of the following is NOT possible using reflection?
Type hinting in PHP allows the identification of the following variable types: (Choose 2)
What is cached by an opcode cache?
Consider the following code. What can be said about the call to file_get_contents?
$getdata = "foo=bar";
$opts = array('http' =>
array(
'method' => 'POST',
'header' => 'Content-type: application/x-www-form-urlencoded',
'content' => $getdata
)
);
$context = stream_context_create($opts);
$result = false, $context);
When a class is defined as final it:
Which value will be assigned to the key 0 in this example?
$foo = array(true, '0' => false, false => true);
PHP's array functions such as array_values() can be used on an object if the object...