Home » PHP » PHP Arrays » Question
  1. What will be the output of the following PHP code?
    <?php
    $Name1 = array_fill(2, 3, "Ajit Kumar Gupta");
    $Name2 = array_fill(1, 2, "Ats Yogi");
    print_r($Name1);
    print_r($Name2);
    ?>
    1. Array
      (
      [2] => Ajit Kumar Gupta
      [3] => Ajit Kumar Gupta
      [4] => Ajit Kumar Gupta
      )
      Array
      (
      [1] => Ats Yogi
      [2] => Ats Yogi
      )
    2. Array
      (
      [2] => Ajit Kumar Gupta
      [3] => Ajit Kumar Gupta
      [4] => Ajit Kumar Gupta
      )

    3. Array
      (
      [1] => Ats Yogi
      [2] => Ats Yogi
      )
    4. Array
      (
      [2] => Ajit Kumar Gupta
      [4] => Ajit Kumar Gupta
      )
      Array
      (
      [2] => Ats Yogi
      )
    5. None of these
Correct Option: A

The array_fill() function fills an array with values.



Your comments will be displayed only after manual approval.