Posted By

HenLen on 01/30/08


Tagged

php banner ads Randomize


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

Nix
vali29


Randomize your banner ads


 / Published in: PHP
 

URL: http://www.shopbetreiber-blog.de

You have banners on your page for advertising? Then you have to randomize the order to be fair.

  1. <?$arr = array(
  2. 0 => "<p>Fill with your html for the first banner</p>",
  3. 1 => "<p>Fill with your html for the 2nd banner</p>",
  4. 2 => "<p>Fill with your html for the 3rd banner</p>"
  5. );
  6.  
  7. // DonĀ“t touch
  8. // Print insertet banner-HTML
  9. shuffle($arr);
  10. foreach($arr as $banner => $value)
  11. {
  12. print $value;
  13. }
  14.  
  15. // Thats it!

Report this snippet  

Comments

RSS Icon Subscribe to comments
Posted By: Nix on May 7, 2008

very nice & useful :)

You need to login to post a comment.