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
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");
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.