This code is probably not the best for click to call but it works.
I have 3 numbers that I want to random in a post. When it comes to display only once whith a unique piece of code it's OK. But when it comes to display the same random number twice lower in a post it's complicated. The displayed numbers are different.
How can I display the same random number (while refreshing the page) several times having control on this.
$numbers = array("800-433-7300", "800-633-3711", "800-756-8613");
switch ($numbers[array_rand($numbers)]) {
case "800-433-7300":
echo '<a href="tel:8004337300">800-433-7300</a>';
break;
case "800-633-3711":
echo '<a href="tel:8006333711">800-633-3711</a>';
break;
default:
echo '<a href="tel:8007568613">800-756-8613</a>';
break;
}
I expect 800-433-7300 will be displayed in different part of the page. Next refreshing page, 800-633-3711 will be displayed as well several times and so on...
Any ideas ? Could you only suggest me a specific function, strcuture or page ressource to solve this by myself ?
Thanks
Aucun commentaire:
Enregistrer un commentaire