Zufällige Auswahl

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Zufällige Auswahl

    Ich hb hier für meine Seite ein Script gemacht, um ein zufälliges Bild auf der Homepage anzeigen zu lassen. Jedoch, werden machmal keine Bilder angezeigt. Kann mir jemand sagen, wo sich ein Bug eingeschlichen hat ????

    PHP Code:
    <?php
    $bild
    [0] = "";
    $bild[1] = "";
    $bild[2] = "";
    $suchaus=rand(0,count($bild));
    $print=$bild[$suchaus];
    echo 
    "$print";
    ?>

  • #2
    PHP Code:
    <?php
    $bild
    [0] = "";
    $bild[1] = "";
    $bild[2] = "";
    $suchaus=rand(0,count($bild)-1);
    $print=$bild[$suchaus];
    echo 
    $print;
    ?>
    meine Projekte bestaunen: http://www.kleiza.de

    Comment


    • #3
      Re: Zufällige Auswahl

      PHP Code:
      <?php
      srand 
      ((double)microtime() * 1000000); // Zufallsgenerator starten

      $bild[0] = "";
      $bild[1] = "";
      $bild[2] = "";
      $suchaus=rand(0,count($bild));
      $print=$bild[$suchaus];
      echo 
      "$print";
      ?>

      Comment


      • #4
        Danke für die Hilfe :P

        Comment

        Working...
        X