nerdexam
Zend

200-530 · Question #428

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

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

Question

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

Options

  • A0 = e 1 = x 2 = z
  • Ba1 = e a2 = x a3 = z
  • CThe script will throw an error message.
  • Da1 = x a2 = e a3 = z

How the community answered

(23 responses)
  • A
    4% (1)
  • B
    17% (4)
  • C
    9% (2)
  • D
    70% (16)

Community Discussion

No community discussion yet for this question.

Full 200-530 Practice