Summer Sale Limited Time 65% Discount Offer - Ends in 0d 00h 00m 00s - Coupon code: ecus65

Zend 200-550 - Zend Certified PHP Engineer

Page: 5 / 7
Total 223 questions

What would be the output of the following code?

namespace MyFramework\DB;

class MyClass {

static function myName() {

return __METHOD__;

}

}

print MyClass::myName();

A.

MyFramework\DB\myName

B.

MyFramework\DB\MyClass\myName

C.

MyFramework\DB\MyClass::myName

D.

MyClass::myName

When uploading a file to a PHP script using the HTTP PUT method, where would the file data be found?

A.

the $_FILES super-global

B.

the input stream php://input

C.

the $_POST super-global

D.

the global variable scope

What is cached by an opcode cache?

A.

Compiled PHP code

B.

Native PHP extensions

C.

Data sent to the client

D.

Data received from the database

What is the output of the following code?

class Bar {

private $a = 'b';

public $c = 'd';

}

$x = (array) new Bar();

echo array_key_exists('a', $x) ? 'true' : 'false';

echo '-';

echo array_key_exists('c', $x) ? 'true' : 'false';

A.

false-false

B.

false-true

C.

true-false

D.

true-true

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($array, $obj);

A.

MyObject should extend class Closure

B.

MyObject should implement interface Callable

C.

MyObject should implement method __call

D.

MyObject should implement method __invoke

What super-global should be used to access information about uploaded files via a POST request?

A.

$_SERVER

B.

$_ENV

C.

$_POST

D.

$_FILES

E.

$_GET

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 = file_get_contents('http://example.com/submit.php', false, $context);

A.

A GET request will be performed on http://example.com/submit.php

B.

A POST request will be performed on http://example.com/submit.php

C.

An error will be displayed

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);

A.

5

B.

10

C.

50

D.

Fatal error

What function can reverse the order of values in an array so that keys are preserved?

A.

array_flip()

B.

array_reverse()

C.

rsort()

D.

krsort()

E.

array_multisort()

What is the output of the following code?

function fibonacci (&$x1 = 0, &$x2 = 1)

{

$result = $x1 + $x2;

$x1 = $x2;

$x2 = $result;

return $result;

}

for ($i = 0; $i < 10; $i++) {

echo fibonacci() . ',';

}

A.

An error

B.

1,1,1,1,1,1,1,1,1,1,

C.

1,1,2,3,5,8,13,21,34,55,

D.

Nothing