From your PHP application, how can you send the same header twice, but with different values?
What is the output of the following code?
for ($i = 0; $i < 1.02; $i += 0.17) {
$a[$i] = $i;
}
echo count($a);
What is the name of the method that can be used to provide read access to virtual properties in a class?
What is the output of the following code?
class Number {
private $v;
private static $sv = 10;
public function __construct($v) { $this->v = $v; }
public function mul() {
return static function ($x) {
return isset($this) ? $this->v*$x : self::$sv*$x;
};
}
}
$one = new Number(1);
$two = new Number(2);
$double = $two->mul();
$x = Closure::bind($double, null, 'Number');
echo $x(5);
Which PHP function is used to validate whether the contents of $_FILES['name']['tmp_name'] have really been uploaded via HTTP?
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()
An HTML form contains this form element:
<input type="file" name="myFile" />
When this form is submitted, the following PHP code gets executed:
move_uploaded_file(
$_FILES['myFile']['tmp_name'],
'uploads/' . $_FILES['myFile']['name']
);
Which of the following actions must be taken before this code may go into production? (Choose 2)
What function can reverse the order of values in an array so that keys are preserved?
Which PHP function retrieves a list of HTTP headers that have been sent as part of the HTTP response or are ready to be sent?
What will be the output value of the following code?
$array = array(1,2,3);
while (list(,$v) = each($array));
var_dump(current($array));
What is the pattern modifier for handling UTF-8 encoded preg_* functionality?
What is the name of the key in $_FILES['name'] that contains the number of bytes of the uploaded file?
How do you allow the caller to submit a variable number of arguments to a function?
Which of the following functions are used to escape data within the context of HTML? (Choose 2)
Which constant must be passed as the second argument to htmlentities() to convert single quotes (') to HTML entities?
How many times will the function counter() be executed in the following code?
function counter($start, &$stop)
{
if ($stop > $start)
{
return;
}
counter($start--, ++$stop);
}
$start = 5;
$stop = 2;
counter($start, $stop);
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 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;
}