Jump to content

Random text load script


Zola

Recommended Posts

I found this code, can someone explain it a little to me please?

 


<?php
$random_text = array("Random Text 1",
                    "Random Text 2",
                    "Random Text 3",
                    "Random Text 4",
                    "Random Text 5");

$sizeof = count($random_text);
$random = (rand()%$sizeof);
print("$random_text[$random]");


?>

 

Why do we need the $sizeof and count?

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.