Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8742609
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T11:31:54+00:00 2026-06-13T11:31:54+00:00

I rotate a banner on my site by selecting it randomly from an array

  • 0

I rotate a banner on my site by selecting it randomly from an array of banners.

Sample code as demonstration:

<?php
$banners = array(
'<iframe>...</iframe>',
'<a href="#"><img src="#.jpg" alt="" /></a>',
//and so on
);
echo $banners(rand(0, count($banners)));
?>

The array of banners has become quite big. I am concerned with the amount of memory that this array adds to the execution of my page.
But I can’t figure out a better way of showing a random banner without loading all the banners into memory…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T11:31:55+00:00Added an answer on June 13, 2026 at 11:31 am

    Move the banners to html files and change the array to contain only filenames.

    Then you can include that file by the name, only loading the banner required.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'd like to test banner (two css background images) and rotate them randomly on
I want to create a custom banner view which will display banners from my
I have a banner (XML_Banner.swf) that is supposed to load and rotate images from
I am trying to rotate image single round from it's center point but I
I want to rotate imageview with continuously looping on android.my code rotate is working
I'm trying to rotate an array such that given a number and an array,
I am trying to rotate an object around it's center with the following code
How do you rotate the text in the axis from horizontal to vertical? I
i want to create dynamic banner rotater wih php ajax i want to pass
I need to rotate an UIImageView: UIImageView *img = [[UIImageView alloc] init]; img.layer.borderWidth =

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.