Need help with php random string please.
Posted 03 September 2006 - 09:46 AM
The one I have only calls on something randomly. Do you know how I can
alter this string to accomodate this? Thanks!
$banner_no = (rand()%(count($s_con)-1));
Just so you know what the above does, gets a random number which is in the content of my file. for instance if I have
3-some other text
It grabs one of these numbers and the text along with it to display randomly. I would like it to display by day and in order instead.
Posted 03 September 2006 - 10:18 AM
Posted 04 September 2006 - 05:33 AM
Posted 04 September 2006 - 09:12 AM
<?php $days = array( 'Sundays text', 'Mondays text, /* etc */ 'Saturdays text' ); echo $days[array_rand($days)]; ?>
Posted 04 September 2006 - 10:53 AM
Sure, your file would contain:
Not sure what you mean, can you show me a string for this please, to use instead of mine. Thank you very much!
And to get todays text, you'd do something like this:
$banner_no = date("w");
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users