What should be the answer of following program ?

Discussion in 'PHP' started by serenasehgal, Sep 25, 2012.

  1. #1
    <?php

    foreach(array_rand(range(1,47), 8) as $number)
    echo "$number";

    ?>
     
    serenasehgal, Sep 25, 2012 IP
  2. GMF

    GMF Well-Known Member

    Messages:
    855
    Likes Received:
    113
    Best Answers:
    19
    Trophy Points:
    145
    #2
    This creates an array with 8 random values. The values are between 1 and 47

    The foreach() iterates through the array and spits out the 8 values :p
     
    Last edited: Sep 25, 2012
    GMF, Sep 25, 2012 IP
  3. dushmant

    dushmant Guest

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    It is display an array which have 8 random values in between 1 and 47.
     
    dushmant, Sep 25, 2012 IP