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

Zend 200-550 - Zend Certified PHP Engineer

Page: 7 / 7
Total 223 questions

Which PHP function sets a cookie and URL encodes its value when sending it to the browser?

What is the result of the following code?

class T

{

const A = 42 + 1;

}

echo T::A;

A.

42

B.

43

C.

Parse error

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.

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

What is the output of this code?

$world = 'world';

echo <<<'TEXT'

hello $world

TEXT;

A.

hello world

B.

hello $world

C.

PHP Parser error

Consider the following XML code:

PHP 5.5 in 42 Hours

Learning PHP 5.5 The Hard Way

Which of the following SimpleXML calls prints the name of the second book?

(Let $xml = simplexml_load_file("books.xml"); .) (Choose 2)

A.

echo $xml->books->book[2];

B.

echo $xml->books->book[1];

C.

echo $xml->book[1];

D.

echo $xml->xpath("/books/book[@id=2]");

E.

$c = $xml->children(); echo $c[1];