mercredi 23 août 2017

random not working if variable == random php

This is my code:

$i = 0;
if($i == rand(1, 5)) {
    // Do Something
    $i = 0;
}
$i++;

I try to add ads between the posts if I replace rand(1, 5) with any number it's working successfully but I need to make it working by random from 1 to 5 so I try to add rand(1, 5) but it's not working.




Aucun commentaire:

Enregistrer un commentaire