3v4l.org

run code in 300+ PHP versions simultaneously
<?php function determineRank($input) { // valor retornado caso $input seja maior que todos os $ranks $default = 'Rainbow'; $ranks = [ 50 => 'Descolorido', 100 => 'Azul Bebê', 200 => 'Roxo Bacon', 300 => 'Verde ET', 500 => 'Marrom Madeira', 700 => 'Laranja Power', 900 => 'Vermelho Killer', 1500 => 'Rosa Piriguete', 1700 => 'Amarelo Bobba', 2000 => 'Turquesa Maravilha', 2300 => 'Gótica Má', 2500 => 'Ametista Destruidor', 2700 => 'Esmeralda Divindade', 3000 => 'Púrpura Star', 3500 => 'Dourado Rei', ]; foreach ($ranks as $rank => $value) { if ($input <= $rank) { return $value; } } return $default; } // Exemplo $i = 0; do { $input = rand(45, 3600); echo $input . ' - ' . determineRank($input) . PHP_EOL; } while(++$i < 20);

Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).

VersionSystem time (s)User time (s)Memory (MiB)
7.3.120.0060.01314.79
7.3.110.0070.01114.87
7.3.100.0060.00914.57
7.3.90.0100.00714.78
7.3.80.0040.00714.99
7.3.70.0030.01214.79
7.3.60.0000.01714.83
7.3.50.0080.00414.88
7.3.40.0070.01014.86
7.3.30.0080.00614.89
7.3.20.0100.00316.84
7.3.10.0040.00916.54
7.3.00.0040.00816.61
7.2.240.0130.00715.24
7.2.230.0000.01515.15
7.2.220.0080.00614.77
7.2.210.0060.01215.06
7.2.200.0110.00415.02
7.2.190.0060.00315.00
7.2.180.0070.01014.79
7.2.170.0100.00714.82
7.2.160.0060.00915.03
7.2.150.0000.01516.95
7.2.140.0060.00616.80
7.2.130.0070.00616.87
7.2.120.0070.00517.02
7.2.110.0050.00916.92
7.2.100.0040.00916.84
7.2.90.0070.01016.97
7.2.80.0050.00816.87
7.2.70.0060.00816.82
7.2.60.0040.01016.96
7.2.50.0050.01116.96
7.2.40.0090.00616.93
7.2.30.0090.00517.05
7.2.20.0070.00616.96
7.2.10.0050.01016.98
7.2.00.0040.01017.41
7.1.330.0110.00715.57
7.1.320.0090.00315.87
7.1.310.0030.01415.81
7.1.300.0060.00615.59
7.1.290.0080.00615.94
7.1.280.0030.01015.86
7.1.270.0060.00315.77
7.1.260.0040.00715.82
7.1.250.0020.00915.90
7.1.70.0030.00617.30
7.1.60.0110.00417.30
7.1.50.0270.00332.79
7.1.40.0270.00732.55
7.1.30.0300.00732.81
7.1.20.0200.01332.71
7.1.10.0070.01314.84
7.1.00.0100.01014.92
7.0.200.0100.00716.85
7.0.190.0100.01014.79
7.0.180.0130.00714.30
7.0.170.0170.00314.38
7.0.160.0200.00014.31
7.0.150.0130.00714.33
7.0.140.0130.00714.44
7.0.130.0130.00714.62
7.0.120.0130.01714.64
7.0.110.0170.00314.45
7.0.100.0070.01314.50
7.0.90.0130.00714.23
7.0.80.0130.01314.51
7.0.70.0170.00714.46
7.0.60.0170.01014.18
7.0.50.0100.01314.50
7.0.40.0100.01014.61
7.0.30.0200.00014.51
7.0.20.0130.00714.33
7.0.10.1070.01314.69
7.0.00.0200.01014.72

preferences:
38.63 ms | 403 KiB | 5 Q