A simple PHP-script for random text

3 replies
This PHP-script shows random text/links or what ever you want.
I was thinking about using it to show AdBrite SmartZone ads.
In one SmartZone is max. 25 ads.
Using this script I can show even more.

And yes, I could use AdRotate if I'm using WP.
But, here it is if you need it.


Code:
< ?
//set the urls
$urls = array(
'- Insert text/link/code here -', // Insert your code/text between the ' '
'- Insert text/link/code here -',
'- Insert text/link/code here -',
'- Insert text/link/code here -'); // Last line, use no comment at the end (,)
 
srand(time());
 
//set the number in (rand()%3); for however many links there are
$random = (rand()%4);
echo ("$urls[$random]");
?>
#phpscript #random #simple #text
  • Profile picture of the author wasabi20
    Thank can be usefull
    {{ DiscussionBoard.errors[5023335].message }}
  • Profile picture of the author drewmcntyre
    Thanks for this post and sharing this script. I hope it will help me in future.
    {{ DiscussionBoard.errors[5024583].message }}
  • Profile picture of the author CyberSEO
    The small replacement will make your script easier in use (don't need to assign the number of links manually).

    Remove:
    //set the number in (rand()%3); for however many links there are
    $random = (rand()%4);
    echo ("$urls[$random]");

    Add:

    echo $urls [rand() % count($urls)];
    Signature
    CyberSEO Pro - the ultimate all-in-one autoblogging WordPress plugin, powered by OpenAI GPT-4, Anthropic Claude, Google Gemini Pro, Midjourney, DALL-E 3 and Stable Diffusion XL
    {{ DiscussionBoard.errors[5134709].message }}

Trending Topics