The following form is loaded in a recent browser and submitted, with the second list element selected:
In the server-side PHP code to deal with the form data, what is the value of $_POST ['list']?
What will be the output of the following code?
$a = array(0, 1, 2 => array(3, 4));
$a[3] = array(4, 5);
echo count($a, 1);
Given the following two functions, what statement is correct?
function dynamicNew($name) {
return new $name;
}
function reflectionNew($name) {
$r = new ReflectionClass($name);
return $r->newInstanceArgs();
}
Which of the following code snippets writes the content of the “source.txt” to “target.txt”?
What is the output of the following code?
1
2 function append($str)
3 {
4 $str = $str.'append';
5 }
6
7 function prepend(&$str)
8 {
9 $str = 'prepend'.$str;
10 }
11
12 $string = 'zce';
13 append(prepend($string));
14 echo $string;
15 ?>
When a browser requests an image identified by an img tag, it never sends a Cookie header.
An HTML form contains this form element:
The user clicks on the image to submit the form. How can you now access the relative coordinates of the mouse click?
How can the id attribute of the 2nd baz element from the XML string below be retrieved from the SimpleXML object found inside $xml?
Which of the following parts must a XML document have in order to be well-formed?
You are creating an application that generates invoices in a variety of formats, including PDF, ODS and HTML. Each of these formats is represented as a PHP class in your application. While some of the operations can be performed on all of the different formats (such as saving and loading), other operations may be specific to one or two of the formats (such as setting as read only). Which design pattern should you use for this application?
Which string will be returned by the following function call?
$test = '/etc/conf.d/wireless';
substr($test, strrpos($test, '/'));
What is the output of the following code?
$first = "second";
$second = "first";
echo $$$first;
Consider the following code. Which keyword should be used in the line marked in bold to make this code work as intended?
You work for a shared hosting provider, and your supervisor asks you to disable user scripts to dynamically load PHP extensions using the dl() function. How can you do this? (Choose 2)
Which of the following functions can help prevent session fixation vulnerabilities?
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;
}
After running this sort, what will be the value of $b?
$a = array('_!', 'def', 0);
$b = sort($a);
What is the output of the following code?
1
2 for ($i = 0; $i < 1.02; $i += 0.17) {
3 $a[$i] = $i;
4 }
5 echo count($a);
6 ?>
Which one of the following technologies was not built into PHP before version 5?