Tags: random

Sort by: Date / Title /

  1. 6 months ago by sx
    1. <?php   
    2.     $textfile = "random.txt";   
    3.     $quotes = file("$textfile");   
    4.     $quote = rand(0sizeof($quotes)-1);   
    5.     echo $quotes[$quote];   
    6.  ?>   
  2. 6 months ago by sx
    1. <?php
    2. $url_list = array(
    3.  'http://www.spiegel.de',
    4.  'http://www.heise.de',
    5.  'http://www.zeit.de',
    6.  'http://www.sopos.org',
    7.  'http://www.nytimes.com',
    8.  'http://www.google.de',
    9.  'http://www.heisec.de',
    10.  'http://www.fireball.de',
    11. );
    12.  
    13. $nbr2get = 3;
    14. srand ((double)microtime()*1000000);
    15. shuffle ($url_list);
    16. $some_random_urls = array_slice($url_list0$nbr2get);
    17. foreach($some_random_urls as $one_url){
    18.     printf('<a href="%s">%s</a><br>'$one_url$one_url);
    19. }
    20. ?>

First / Previous / Next / Last / Page 1 of 1 (2 posteets)