Jump to content

envec83

New Members
  • Posts

    4
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

envec83's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Exactly what I needed derwert, thanks a lot!
  2. Hmm, I guess calling the ad by "ad1" will eliminate the random factor. Maybe something like this instead: <?php $ads = array['<img src="ad1" />' , '<img src="ad2" />']; shuffle($ads); echo $ads[0]; ?> Will the line "echo $ads[0];" actually call the first element of the array after it was randomized? Thanks
  3. That could work. How would the final code look like though? Maybe something like this: <?php $adds = array["ad1"=>"<img src="ad1" />","ad2"=>"<img src="ad2" />"]; shuffle($adds); echo $adds["add1"]; ?> Or did I make any mistake there? Thanks
  4. Hi, I code in C/C++, but I don't know PHP. I am basically trying to write some PHP code to perform split testing on my WordPress blog. That is, I want to have a PHP code that will output one ad half the times, and a second ad the other half. I think it would be possible to do this generating a random number or reading the time, and then outputting one ad if the number is odd, and the second ad if the number is even, right? So something like this in pseudo code: x = random number; if (x is odd) <img src="ad1" /> else <img src="ad2" /> Could anyone let me know how this code would be on PHP? Thanks a lot.
×
×
  • 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.