What is the output of the following code?
class Base {
protected static function whoami() {
echo "Base ";
}
public static function whoareyou() {
static::whoami();
}
}
class A extends Base {
public static function test() {
Base::whoareyou();
self::whoareyou();
parent::whoareyou();
A. :whoareyou();static::whoareyou();}public static function whoami() {echo "A ";}}class B extends A {public static function whoami() {echo "B ";}}
B. :test();
C. B B B B B
D. Base A Base A B
E. Base B B A B
F. Base B A A B
What information can be used to reliably determine the type of an uploaded file?
A. MIME type
B. File name extension
C. Contents of the file
Which interfaces could class C implement in order to allow each statement in the following code to work?
(Choose 2)
$obj = new C();
foreach ($obj as $x => $y) {
echo $x, $y;
}
A. Iterator
B. ArrayAccess
C. IteratorAggregate
D. ArrayObject
What is the output of the following code?
$a = array('a', 'b'=>'c');
echo property_exists((object) $a, 'a')?'true':'false'; echo '-';
echo property_exists((object) $a, 'b')?'true':'false';
A. false-false
B. false-true
C. true-false
D. true-true
Given a php.ini setting of
default_charset = utf-8
what will the following code print in the browser?
header('Content-Type: text/html; charset=iso-8859-1');
echo 'and#9986;and#10004;and#10013;';
A. Three Unicode characters, or unreadable text, depending on the browser
B. and#9986;and#10004;and#10013;
C. A blank line due to charset mismatch
How can you determine whether a PHP script has already sent cookies to the client?
A. Use $_COOKIE
B. Use the getcookie() function
C. Use the headers_sent() function
D. Use JavaScript to send a second HTTP request
How many times will the function counter() be executed in the following code?
function counter($start, and$stop)
{
if ($stop > $start)
{
return;
}
counter($start--, ++$stop);
}
$start = 5;
$stop = 2;
counter($start, $stop);
A. 3
B. 4
C. 5
D. 6
Which of the following statements about Reflection is correct?
A. Reflection is an extension that can be disabled
B. Reflection is a new extension present only in PHP 5.3+
C. Reflection only allows to reflect on built-in classes
D. Built-in classes can be reflected on command line using php --rc
Which of the following rules must every correct XML document adhere to? (Choose 2) A. It has to be well-formed.
B. It has to be valid.
C. It has to be associated to a DTD.
D. It may only contain UTF-8 encoded characters.
Given the default PHP configuration, how can all of the parameters provided via GET be accessed in a form of a string?
A. $_GET['ALL']
B. $_SERVER['QUERY']
C. $_SERVER['QUERY_STRING']
D. $_ENV['QUERY']
E. $QUERY_STRING