Go Back   Free website templates > Web Template Help > PHP and MySQL

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 02-08-2009, 02:48 PM
vareside's Avatar
Senior Member
 
Join Date: Jul 2007
Posts: 268
vareside is on a distinguished road
Post PHP Random

Hi folks,

I need help. I need a script that displays pre-defined HTML codes in a random order. Could someone help me by creating such a small script for me?
Reply With Quote
  #2 (permalink)  
Old 04-08-2009, 07:24 AM
vareside's Avatar
Senior Member
 
Join Date: Jul 2007
Posts: 268
vareside is on a distinguished road
Post no Need

I created one myself. Here we go:
PHP Code:
$text_1 "some text";
$text_2 "some text2";
$text_3 "some text3";
$text_4 "some text4";

$total_texts rand(1,4);
echo 
"<blockquote>&ldquo;".${text_.$total_texts}."&rdquo;</blockquote>"
See example at WISE QUOTE on http://vareside.com/
Reply With Quote
  #3 (permalink)  
Old 04-24-2009, 01:03 AM
candycrate's Avatar
Junior Member
 
Join Date: Apr 2009
Location: Greece
Posts: 3
candycrate is on a distinguished road
Default

PHP Code:
// Random HTML codes
$Random_Values=array('text1','text2','text3');

// Generate a seed for REAL random numbers
mt_srand((double)microtime()*1000000);

// Pick a random code
echo $Random_Values[mt_rand(0,(count($Random_Values)-1))]; 
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 03:27 AM.