create website with a coinflip system php

Let us talk about scripts, HTML, Perl, PHP, apache, etc.
User avatar
Stevyn
SysOp
Posts:1786
Joined:Mon Nov 09, 2009 10:03 am
Location:Japan
Contact:
create website with a coinflip system php

Post by Stevyn » Sun Apr 18, 2021 11:21 am

create website with a coinflip system php

https://stackoverflow.com/questions/471 ... vably-fair

Code: Select all

$result = array("heads", "tails")[random_int(0,1)];
As a bonus, you could add more elements to this array, and then just increase the max value in random_int(), and it will work. You could make this more dynamic as-well by doing it like this:

Code: Select all

$choices = ["heads", "tails", "Coin flew off the table"];
$result = $choices[random_int(0, count($choices)-1];
Contact me directly: Ironfeatherbooks (@) gmail.com

Image

Post Reply