Zend Certified PHP Engineer 200-550 Question # 26 Topic 3 Discussion

Zend Certified PHP Engineer 200-550 Question # 26 Topic 3 Discussion

200-550 Exam Topic 3 Question 26 Discussion:
Question #: 26
Topic #: 3

Consider the following table data and PHP code. What is a possible 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 name, email FROM users LIMIT 1";

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

$stmt->execute();

$result = $stmt->fetchAll(PDO::FETCH_BOTH);

$row = $result[0];


A.

The value of $row is `array(0 => 'anna', 1 => 'alpha@example.com')`.


B.

The value of $row is `array('name' => 'anna', 'email' => 'alpha@example.com')`.


C.

The value of $row is `array(0 => 'anna', 'name' => 'anna', 1 => 'alpha@example.com', 'email' => 'alpha@example.com')`.


D.

The value of $result is `array('anna' => 'alpha@example.com')`.


Get Premium 200-550 Questions

Contribute your Thoughts:


Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.