Jump to content

Need help with php random string please.


Rianna

Recommended Posts

Hello, I would like to change some php to calling on something by day.
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
1-some text
2-different text
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.
Link to comment
https://forums.phpfreaks.com/topic/19561-need-help-with-php-random-string-please/
Share on other sites

[quote author=Rianna link=topic=106716.msg427550#msg427550 date=1157348033]
Not sure what you mean, can you show me a string for this please, to use instead of mine. Thank you very much!
[/quote]
Sure, your file would contain:
0-Sundays text
1-Mondays text
2-Tuesdays text
3-Wednesdays text
4-Thursdays text
5-Fridays text
6-Saturdays text

And to get todays text, you'd do something like this:
$banner_no = date("w");

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.