Skip to content

Latest commit

 

History

History
23 lines (20 loc) · 699 Bytes

0079.md

File metadata and controls

23 lines (20 loc) · 699 Bytes

What will be the output of the given PHP code?

$name = array("d" => "Mark""a" => "David""b" => "Peter""c" => "Martha");
$nameArrayObject = new ArrayObject($name);
$nameArrayObject->ksort(); 
foreach ($nameArrayObject as $key => $val) {
    echo "$key = $val\n";
}
  • A) a = David b = Peter c = Martha d = Mark
  • B) a = Mark b = David c = Peter d = Martha
  • C) a = David b = Mark c = Martha d = Peter
  • D) The script will throw an error message.
Answer

Answer: A