"Daffodil", "002"=>"Dahlia", "003"=>"Daisy", "004"=>"Dianella", "005"=>"Delphinium");$flowre2"> What will be the output of the following PHP code?<?php$flowre1

Home » PHP » PHP Arrays » Question
  1. What will be the output of the following PHP code?
    <?php
    $flowre1 = array("001"=>"Daffodil", "002"=>"Dahlia", "003"=>"Daisy", "004"=>"Dianella", "005"=>"Delphinium");
    $flowre2 = array("006"=>"Daffodil", "007"=>"Dahlia", "008"=>"Daisy");
    $Res = array_diff($flowre1, $flowre2);
    print_r($Res);
    ?>
    1. Array
      (
      [004]
      [005]
      )
    2. Array
      (
      Dianella
      Delphinium
      )
    3. Array
      (
      [004] => Dianella
      )
    4. Array
      (
      [004] => Dianella
      [005] => Delphinium
      )
    5. None of these
Correct Option: D

The array_diff() function compares the values of two (or more) arrays, and returns the differences.



Your comments will be displayed only after manual approval.