nerdexam
Zend

200-530 · Question #396

Consider the following code: <?php $array = array("a1"=>x,"a2"=>e,"a3"=>z); asort( $array ); foreach ( $array as $keys => $values ) { print "$keys = $values "; } ?> What will be the output?

The correct answer is C. a2 = e a1 = x a3 = z. See the full explanation below for the reasoning.

Question

Consider the following code: <?php $array = array("a1"=>x,"a2"=>e,"a3"=>z); asort( $array ); foreach ( $array as $keys => $values ) { print "$keys = $values "; } ?> What will be the output?

Exhibit

200-530 question #396 exhibit

Options

  • Aa1 = e a2 = x a3 = z
  • BThe script will throw an error message.
  • Ca2 = e a1 = x a3 = z
  • D0 = e 1 =x 2 = z

How the community answered

(62 responses)
  • A
    3% (2)
  • B
    6% (4)
  • C
    77% (48)
  • D
    13% (8)

Community Discussion

No community discussion yet for this question.

Full 200-530 Practice