Home » PHP » PHP Sorting Arrays » Question
  1. What will be the output of the following PHP code?
    <?php
    $First = array("001" => "Ajit", "002" => "Ats", "003" => "Aju");
    echo array_shift($First);
    echo "\n";
    array_pop($First);
    print_r($First);
    ?>
    1. Ajit
      Array
      (
      [002] => Ats
      )
    2. Aju
      Array
      (
      [002] => Ats
      )
    3. Error
    4. Nothing
    5. None of these
Correct Option: A

array_shift() removes first element and array_pop() removes the last.



Your comments will be displayed only after manual approval.