Random Images And text

ak007

Member
Messages
216
Reaction score
0
Points
16
Heres A Very Simple Tutorial For Displaying Random Images And Text Lets Start With Random Images
------------
Functions We Will Use:
shuffle()
------------
PHP:
<?php
$images = array("whacky.jpg" , "bush.jpg" , "xxx.jpg" , "BooM.jpg" , "blah.png");
shuffle($images);
echo "<img src=\"images/$images[1]\"/>";
?>

Now The Random Text
PHP:
<?php
$quotes = array("X10hosting RockZ","Blah Blah ","Knock Knock!!!","Whos there?","Its me!!","Who?");
shuffle($quotes);
echo $quotes[1];
?>
Comments Question And Suggestions Are Welcomed ;)
 
Last edited:

ak007

Member
Messages
216
Reaction score
0
Points
16
LOL Just Create A New page And Put the Code in It
And For Random Images To Add New Images Just Add The Name Of The Images in The Array:
PHP:
$images = array("whacky.jpg" , "bush.jpg" , "xxx.jpg" , "BooM.jpg" , "blah.png" , "YOUR IMAGE NAME GOES HERE!!!!");

And To Change The Image Directory Where The Script will Pick The Images Just Change
PHP:
echo "<img src=\"images/$images[1]\"/>"

TO

PHP:
echo "<img src=\"MY_IMAGE_DIR/$images[1]\"/>"
 
Last edited:

Jake

Developer
Contributors
Messages
4,057
Reaction score
5
Points
0
wow, this works very nicely... even though i would never really need to use it, at least notyet... good tutorial though!
 

Kay

New Member
Messages
804
Reaction score
0
Points
0
Thats would not use it now - but maybe in the future.
 
M

minievan

Guest
Me Either.
I Guess we wont worl out what he said. ''gamez93'' Banned...
 

ak007

Member
Messages
216
Reaction score
0
Points
16
Yeah He's Now Banned Cuz Of So Many Annoying Complaints
 
Top