?
Solved

50/50 random include

Posted on 2009-02-20
2
Medium Priority
?
299 Views
Last Modified: 2012-05-06
Looking for a little PHP that will allow me to have 2 includes and which one is displayed is random.
0
Comment
Question by:a204801
  • 2
2 Comments
 
LVL 39

Accepted Solution

by:
Roger Baklund earned 1500 total points
ID: 23696748
Try this:
if(rand(0,1)) include('a.php');
else include('b.php')

Open in new window

0
 
LVL 39

Expert Comment

by:Roger Baklund
ID: 23696774
You must of couse replace a.php and b.php with your file names, and end line two with ;
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
In this blog, we’ll look at how improvements to Percona XtraDB Cluster improved IST performance.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Suggested Courses
Course of the Month17 days, 8 hours left to enroll

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question