Summer Special - 65% Discount Offer - Ends in 0d 00h 00m 00s - Coupon code: c4sdisc65

200-550 PDF

$38.5

$109.99

3 Months Free Update

  • Printable Format
  • Value of Money
  • 100% Pass Assurance
  • Verified Answers
  • Researched by Industry Experts
  • Based on Real Exams Scenarios
  • 100% Real Questions

200-550 PDF + Testing Engine

$61.6

$175.99

3 Months Free Update

  • Exam Name: Zend Certified PHP Engineer
  • Last Update: Sep 13, 2025
  • Questions and Answers: 223
  • Free Real Questions Demo
  • Recommended by Industry Experts
  • Best Economical Package
  • Immediate Access

200-550 Engine

$46.2

$131.99

3 Months Free Update

  • Best Testing Engine
  • One Click installation
  • Recommended by Teachers
  • Easy to use
  • 3 Modes of Learning
  • State of Art Technology
  • 100% Real Questions included

200-550 Practice Exam Questions with Answers Zend Certified PHP Engineer Certification

Question # 6

Consider the following table data and PHP code. What is the outcome?

Table data (table name "users" with primary key "id"):

id name email

------- ----------- -------------------

1 anna alpha@example.com

2 betty beta@example.org

3 clara gamma@example.net

5 sue sigma@example.info

PHP code (assume the PDO connection is correctly established):

$dsn = 'mysql:host=localhost;dbname=exam';

$user = 'username';

$pass = '********';

$pdo = new PDO($dsn, $user, $pass);

$cmd = "SELECT * FROM users WHERE id = :id";

$stmt = $pdo->prepare($cmd);

$id = 3;

$stmt->bindParam('id', $id);

$stmt->execute();

$stmt->bindColumn(3, $result);

$row = $stmt->fetch(PDO::FETCH_BOUND);

A.

The database will return no rows.

B.

The value of $row will be an array.

C.

The value of $result will be empty.

D.

The value of $result will be 'gamma@example.net'.

Full Access
Question # 7

What is the output of the following code?

echo '1' . (print '2') + 3;

A.

123

B.

213

C.

142

D.

214

E.

Syntax error

Full Access
Question # 8

When would you use classes and when would you use namespaces?

A.

Use classes to encapsulate code and represent objects, and namespaces to avoid symbol name collisions

B.

Use classes for performance-sensitive code, and namespaces when readability matters more

C.

Use namespaces for performance-sensitive code, and classes when readability matters more

D.

Always use them; namespaces are always superior to classes

Full Access
Question # 9

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

A.

3

B.

4

C.

5

D.

6

Full Access
Question # 10

Consider the following table data and PHP code, and assume that the database supports transactions. What is the outcome?

Table data (table name "users" with primary key "id"):

id name email

------- ----------- -------------------

1 anna alpha@example.com

2 betty beta@example.org

3 clara gamma@example.net

5 sue sigma@example.info

PHP code (assume the PDO connection is correctly established):

$dsn = 'mysql:host=localhost;dbname=exam';

$user = 'username';

$pass = '********';

$pdo = new PDO($dsn, $user, $pass);

try {

$pdo->exec("INSERT INTO users (id, name, email) VALUES (6, 'bill', 'delta@example.com')");

$pdo->begin();

$pdo->exec("INSERT INTO users (id, name, email) VALUES (7, 'john', 'epsilon@example.com')");

throw new Exception();

} catch (Exception $e) {

$pdo->rollBack();

}

A.

The user 'bill' will be inserted, but the user 'john' will not be.

B.

Both user 'bill' and user 'john' will be inserted.

C.

Neither user 'bill' nor user 'john' will be inserted.

D.

The user 'bill' will not be inserted, but the user 'john' will be.

Full Access
Question # 11

Transactions are used to...

A.

guarantee high performance

B.

secure data consistency

C.

secure access to the database

D.

reduce the database server overhead

E.

reduce code size in PHP

Full Access
Question # 12

What is the output of the following code?

echo 0x33, ' monkeys sit on ', 011, ' trees.';

A.

33 monkeys sit on 11 trees.

B.

51 monkeys sit on 9 trees.

C.

monkeys sit on trees.

D.

0x33 monkeys sit on 011 trees.

Full Access
Question # 13

Please provide the name of the super-global variable where all the information about cookies is available.

Full Access
Question # 14

Given a DateTime object that is set to the first second of the year 2014, which of the following samples will correctly return a date in the format '2014-01-01 00:00:01'?

A.

$datetime->format('%Y-%m-%d %h:%i:%s')

B.

$datetime->format('%Y-%m-%d %h:%i:%s', array('year', 'month', 'day', 'hour', 'minute', 'second'))

C.

$datetime->format('Y-m-d H:i:s')

D.

$date = date('Y-m-d H:i:s', $datetime);

Full Access
Question # 15

Given the following DateTime objects, what can you use to compare the two dates and indicate that $date2 is the later of the two dates?

$date1 = new DateTime('2014-02-03');

$date2 = new DateTime('2014-03-02');

A.

$date2 > $date1

B.

$date2 < $date1

C.

$date1->diff($date2) < 0

D.

$date1->diff($date2) > 0

Full Access
Question # 16

PHP's array functions such as array_values() can be used on an object if the object...

A.

implements Traversable

B.

is an instance of ArrayObject

C.

implements ArrayAccess

D.

None of the above

Full Access
Question # 17

Which of the following is NOT possible using reflection?

A.

Analysing of nearly any aspect of classes and interfaces

B.

Analysing of nearly any aspect of functions

C.

Adding class methods

D.

Implement dynamic construction (new with variable class name)

Full Access
Question # 18

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

Full Access
Question # 19

How can the id attribute of the 2nd baz element from the XML string below be retrieved from the SimpleXML object

found inside $xml?

One

Two

A.

$xml->getElementById('2');

B.

$xml->foo->bar->baz[2]['id']

C.

$xml->foo->baz[2]['id']

D.

$xml->foo->bar->baz[1]['id']

E.

$xml->bar->baz[1]['id']

Full Access
Question # 20

What is the output of the following code?

function append($str)

{

$str = $str.'append';

}

function prepend(&$str)

{

$str = 'prepend'.$str;

}

$string = 'zce';

append(prepend($string));

echo $string;

A.

zceappend

B.

prependzceappend

C.

prependzce

D.

zce

Full Access
Question # 21

Which class of HTTP status codes is used for redirections?

A.

2XX

B.

3XX

C.

4XX

D.

5XX

Full Access
Question # 22

How can a SimpleXML object be converted to a DOM object?

A.

dom_import_simplexml()

B.

dom_export_simplexml()

C.

simplexml_import_dom()

D.

SimpleXML2Dom()

E.

None of the above.

Full Access
Question # 23

What is the result of the following code?

define('PI', 3.14);

class T

{

const PI = PI;

}

class Math

{

const PI = T::PI;

}

echo Math::PI;

A.

Parse error

B.

3.14

C.

PI

D.

T::PI

Full Access
Question # 24

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

Full Access
Question # 25

Which of these statements about PDO is NOT true?

A.

PDO has built-in support for Large Objects (LOBs).

B.

Placeholders within PDO prepared statements need to be named.

C.

When something goes wrong, PDO can throw an instance of its own exception class.

D.

PDO does not emulate missing database features.

Full Access
Question # 26

Before the headers are sent, how can you remove a previously set header?

A.

Use the header_remove() function, providing the name of the header

B.

Use the die() function to abort the PHP script

C.

Not possible

D.

Use the headers_list() function, providing the name of the header as the second argument

Full Access
Question # 27

In the following code, which classes can be instantiated?

abstract class Graphics {

abstract function draw($im, $col);

}

abstract class Point1 extends Graphics {

public $x, $y;

function __construct($x, $y) {

$this->x = $x;

$this->y = $y;

}

function draw($im, $col) {

ImageSetPixel($im, $this->x, $this->y, $col);

}

}

class Point2 extends Point1 { }

abstract class Point3 extends Point2 { }

A.

Graphics

B.

Point1

C.

Point2

D.

Point3

E.

None, the code is invalid

Full Access
Question # 28

Which of the following superglobals does not necessarily contain data from the client?

A.

$_POST

B.

$_SESSION

C.

$_GET

D.

$_SERVER

Full Access
Question # 29

What will the following code print out?

$str = '✔ one of the following';

echo str_replace('✔', 'Check', $str);

A.

Check one of the following

B.

one of the following

C.

✔ one of the following

Full Access
Question # 30

Which of the following items in the $_SERVER superglobal are important for authenticating the client when using HTTP Basic authentication? (Choose 2)

A.

PHP_AUTH_TYPE

B.

PHP_AUTH_PASSWORD

C.

PHP_AUTH_DIGEST

D.

PHP_AUTH_PW

E.

PHP_AUTH_USER

Full Access
Question # 31

Which of the following statements about PHP is false? (Choose 2)

A.

A final class can be derived.

B.

A final class may be instantiated.

C.

A class with a final function may be derived.

D.

Static functions can be final.

E.

Properties can be final.

Full Access
Question # 32

Which of the following code snippets DO NOT write the exact content of the file "source.txt" to "target.txt"? (Choose 2)

A.

file_put_contents("target.txt", fopen("source.txt", "r"));

B.

file_put_contents("target.txt", readfile("source.txt"));

C.

file_put_contents("target.txt", join(file("source.txt"), "\n"));

D.

file_put_contents("target.txt", file_get_contents("source.txt"));

E.

$handle = fopen("target.txt", "w+"); fwrite($handle, file_get_contents("source.txt")); fclose($handle);

Full Access
Question # 33

Which PHP function sets a cookie whose value does not get URL encoded when sending it to the browser?

Full Access
Question # 34

What is the output of the following code?

function ratio ($x1 = 10, $x2)

{

if (isset ($x2)) {

return $x2 / $x1;

}

}

echo ratio (0);

A.

0

B.

An integer overflow error

C.

A warning, because $x1 is not set

D.

A warning, because $x2 is not set

E.

A floating-point overflow error

F.

Nothing

Full Access
Question # 35

In order to create an object storage where each object would be stored only once, you may use which of the following? (Choose 2)

A.

SplFixedArray

B.

SplObjectStorage

C.

SplString

D.

spl_object_hash

E.

spl_same_object

Full Access
Question # 36

What content-type is required when sending an HTTP POST using JavaScript to ensure that PHP can access the data?

A.

application/x-www-form-urlencoded

B.

http/post

C.

text/html

D.

object/multipart-formdata

Full Access
Question # 37

The following form is loaded in a browser and submitted, with the checkbox activated:

In the server-side PHP code to deal with the form data, what is the value of $_POST['accept'] ?

A.

accept

B.

ok

C.

true

D.

on

Full Access
Question # 38

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

Full Access
Question # 39

When using password_hash() with the PASSWORD_DEFAULT algorithm constant, which of the following is true? (Choose 2)

A.

The algorithm that is used for hashing passwords can change when PHP is upgraded.

B.

The salt option should always be set to a longer value to account for future algorithm requirements.

C.

The string length of the returned hash can change over time.

D.

The hash algorithm that's used will always be compatible with crypt() .

Full Access
Question # 40

What is the difference between "print" and "echo"?

A.

There is no difference.

B.

Print has a return value, echo does not

C.

Echo has a return value, print does not

D.

Print buffers the output, while echo does not

E.

None of the above

Full Access
Question # 41

Which of the following statements is NOT correct?

A.

Only methods can have type hints

B.

Typehints can be optional

C.

Typehints can be references

Full Access
Question # 42

Which of the following is NOT true about PHP traits? (Choose 2)

A.

Multiple traits can be used by a single class.

B.

A trait can implement an interface.

C.

A trait can declare a private variable.

D.

Traits are able to be auto-loaded.

E.

Traits automatically resolve conflicts based on definition order.

Full Access
Question # 43

What is the result of the following code?

class T

{

const A = 42 + 1;

}

echo T::A;

A.

42

B.

43

C.

Parse error

Full Access
Question # 44

What is the return value of the following code?

strpos("me myself and I", "m", 2)

A.

2

B.

3

C.

4

D.

0

E.

1

Full Access
Question # 45

Under what condition may HTTP headers be set from PHP if there is content echoed prior to the header function being used?

A.

headers_sent() returns true

B.

Output buffering is enabled

C.

The client supports local buffering

D.

The webserver uses preemptive mode

Full Access
Question # 46

What method can be used to find the tag via the DOM extension?

A.

getElementById()

B.

getElementsByTagName()

C.

getElementsByTagNameNS()

D.

getElementByName()

E.

findTag()

Full Access
Question # 47

When a query that is supposed to affect rows is executed as part of a transaction, and reports no affected rows, it could mean that: (Choose 2)

A.

The transaction failed

B.

The transaction affected no lines

C.

The transaction was rolled back

D.

The transaction was committed without error

Full Access
Question # 48

Which of the following statements is correct?

A.

Interfaces can extend only one interface

B.

Interfaces can extend more than one interface

C.

Interfaces can inherit a method from different interfaces

D.

Interfaces can redeclare inherited methods

Full Access
Question # 49

Which of the following tasks can be achieved by using magic methods? (Choose 3)

A.

Initializing or uninitializing object data

B.

Creating a new stream wrapper

C.

Creating an iterable object

D.

Processing access to undefined methods or properties

E.

Overloading operators like +, *, etc.

F.

Converting objects to string representation

Full Access
Question # 50

Consider the following code. Which keyword should be used in the line marked with "KEYWORD" instead of "self" to make this code work as intended?

abstract class Base {

protected function __construct() {

}

public static function create() {

return new self(); // KEYWORD

}

abstract function action();

}

class Item extends Base {

public function action() { echo __CLASS__; }

}

$item = Item::create();

$item->action(); // outputs "Item"

Full Access
Question # 51

Given the following DateTime object, which sample will NOT alter the date to the value '2014-02-15'?

$date = new DateTime('2014-03-15');

A.

$date->sub(new DateInterval('P1M'));

B.

$date->setDate(2014, 2, 15);

C.

$date->modify('-1 month');

D.

$date->diff(new DateInterval('-P1M'));

Full Access
Question # 52

What DOMElement method should be used to check for availability of a non-namespaced attribute?

A.

getAttributeNS()

B.

getAttribute()

C.

hasAttribute()

D.

hasAttributeNS()

Full Access
Question # 53

What does the __FILE__ constant contain?

A.

The filename of the current script.

B.

The full path to the current script.

C.

The URL of the request made.

D.

The path to the main script.

Full Access
Question # 54

Which technique should be used to speed up joins without changing their results?

A.

Add indices on joined columns

B.

Add a WHERE clause

C.

Add a LIMIT clause

D.

Use an inner join

Full Access
Question # 55

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

A.

2, 3, 4

B.

2, 3, 6

C.

4, 5, 6

D.

1, 2, 3

Full Access
Question # 56

Consider the following table data and PHP code. What is the outcome?

Table data (table name "users" with primary key "id"):

id name email

------- ----------- -------------------

1 anna alpha@example.com

2 betty beta@example.org

3 clara gamma@example.net

5 sue sigma@example.info

PHP code (assume the PDO connection is correctly established):

$dsn = 'mysql:host=localhost;dbname=exam';

$user = 'username';

$pass = '********';

$pdo = new PDO($dsn, $user, $pass);

try {

$cmd = "INSERT INTO users (id, name, email) VALUES (:id, :name, :email)";

$stmt = $pdo->prepare($cmd);

$stmt->bindValue('id', 1);

$stmt->bindValue('name', 'anna');

$stmt->bindValue('email', 'alpha@example.com');

$stmt->execute();

echo "Success!";

} catch (PDOException $e) {

echo "Failure!";

throw $e;

}

A.

The INSERT will succeed and the user will see the "Success!" message.

B.

The INSERT will fail because of a primary key violation, and the user will see the "Success!" message.

C.

The INSERT will fail because of a primary key violation, and the user will see a PDO warning message.

D.

The INSERT will fail because of a primary key violation, and the user will see the "Failure!" message.

Full Access
Question # 57

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)

A.

Set enable_dl to Off in the server's php.ini configuration file.

B.

Add dl to the current value of disable_functions in the server's php.ini configuration file.

C.

Add dl to the current value of disable_classes in the server's php.ini configuration file.

D.

Write a custom function called dl() , save it under the name prepend.inc and then set the auto_prepend_file directive to prepend.inc in php.ini.

Full Access
Question # 58

You want to allow your users to submit HTML code in a form, which will then be displayed as real code and not affect your page layout. Which function do you apply to the text, when displaying it? (Choose 2)

A.

strip_tags()

B.

htmlentities()

C.

htmltidy()

D.

htmlspecialchars()

E.

showhtml()

Full Access
Question # 59

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

Full Access
Question # 60

Which PHP function is used to validate whether the contents of $_FILES['name']['tmp_name'] have really been uploaded via HTTP, and also save the contents into another folder?

Full Access
Question # 61

When a browser requests an image identified by an img tag, it never sends a Cookie header.

A.

TRUE

B.

FALSE

Full Access
Question # 62

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?

A.

header()

B.

headers()

C.

headers_list()

D.

headers_sent()

E.

getresponseheaders()

Full Access
Question # 63

Which of the following are valid identifiers? (Choose 3)

A.

function 4You() { }

B.

function _4You() { }

C.

function object() { }

D.

$1 = "Hello";

E.

$_1 = "Hello World";

Full Access
Question # 64

Please provide the value of the $code variable in the following statement to set an HTTP status code that signifies that the requested resource was not found.

http_response_code($code);

Full Access
Question # 65

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

A.

22333

B.

33222

C.

33322

D.

222333

Full Access
Question # 66

What DOM method is used to load HTML files?

A.

load()

B.

loadXML()

C.

loadHTML()

D.

loadHTMLFile()

Full Access