3v4l.org

run code in 500+ PHP versions simultaneously
<?php $games = [["First", 1.14], ["2nd", 1.18], ["3rd", 1.22]]; $rand1 = array_rand($games); $rand2 = array_rand($games); $val1 = $games[$rand1][1]; $val2 = $games[$rand2][1]; echo sprintf( "The product of '%s' (%f) and '%s' (%f) is %f", $games[$rand1][0], $val1, $games[$rand2][0], $val2, $val1 * $val2 );
Output for 7.4.3, 7.4.12, 7.4.20, 7.4.24, 8.0.11, 8.0.15, 8.1.2
The product of 'First' (1.140000) and '2nd' (1.180000) is 1.345200
Output for 7.4.13, 7.4.16, 7.4.21, 8.0.2, 8.0.5, 8.1.1
The product of '2nd' (1.180000) and '3rd' (1.220000) is 1.439600
Output for 7.4.5, 7.4.10, 7.4.14, 7.4.18, 8.0.3, 8.0.8, 8.1.0
The product of '2nd' (1.180000) and '2nd' (1.180000) is 1.392400
Output for 7.4.0, 7.4.4, 7.4.9, 7.4.11, 8.0.1, 8.0.7, 8.0.14
The product of '3rd' (1.220000) and 'First' (1.140000) is 1.390800
Output for 7.4.1, 7.4.15, 8.0.13
The product of '3rd' (1.220000) and '3rd' (1.220000) is 1.488400
Output for 7.4.2, 7.4.19, 7.4.26, 8.0.10, 8.0.12
The product of 'First' (1.140000) and 'First' (1.140000) is 1.299600
Output for 7.4.7, 7.4.22, 8.0.9
The product of '2nd' (1.180000) and 'First' (1.140000) is 1.345200
Output for 7.4.8, 7.4.23, 7.4.25, 8.0.6
The product of 'First' (1.140000) and '3rd' (1.220000) is 1.390800
Output for 7.4.6, 7.4.27
The product of '3rd' (1.220000) and '2nd' (1.180000) is 1.439600

preferences:
47.85 ms | 658 KiB | 4 Q