Random Text

Discussion in 'PHP' started by wskmm, May 1, 2007.

  1. #1
    Noobie looking for a simple php script that will display a random text selection from a group of 3 or 4 choices (or perhaps more) and does not use lots of server resources.

    Thanks
     
    wskmm, May 1, 2007 IP
  2. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #2
    
    
    <?php
    
    $phrases = array(
        'text 1',
        'text 2',
        'text 3',
        'text 4'
    );
    
    $phrase = $phrases[array_rand($phrases)];
    
    echo $phrase;
    
    ?>
    
    PHP:
     
    nico_swd, May 1, 2007 IP