3v4l.org

run code in 300+ PHP versions simultaneously
<?php const PERMANENT = -1; function has_permanent(array $max_ages) { $has_permanent = FALSE; foreach ($max_ages as $max_age) { if ($max_age === PERMANENT) { $has_permanent = TRUE; break; } } return $has_permanent; } $max_ages_1 = [0, 0]; $max_ages_2 = [0, 60]; $max_ages_3 = [0, PERMANENT]; $max_ages_4 = [60, PERMANENT]; $max_ages_5 = [PERMANENT, PERMANENT]; for ($i = 0; $i < 10000; $i++) { has_permanent($max_ages_1)); has_permanent($max_ages_2)); has_permanent($max_ages_3)); has_permanent($max_ages_4)); has_permanent($max_ages_5)); }

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)
5.4.380.0200.05318.77
5.4.370.0070.06318.82
5.4.360.0270.04718.59
5.4.350.0130.06018.48
5.4.340.0170.05318.76
5.4.320.0230.04718.57
5.4.310.0200.05018.59
5.4.300.0130.05318.50
5.4.290.0200.04718.79
5.4.280.0130.05718.79
5.4.270.0170.06018.74
5.4.260.0100.06018.73
5.4.250.0270.04318.77
5.4.240.0170.05718.45
5.4.230.0230.04318.52
5.4.220.0270.05318.75
5.4.210.0200.06718.75
5.4.200.0170.05316.61
5.4.190.0200.05318.69
5.4.180.0100.06018.73
5.4.170.0230.05318.75
5.4.160.0300.03718.76
5.4.150.0330.04718.73
5.4.140.0170.05016.24
5.4.130.0200.05016.28
5.4.120.0270.04716.45
5.4.110.0230.04716.29
5.4.100.0170.05316.28
5.4.90.0200.04716.20
5.4.80.0100.05316.41
5.4.70.0170.05016.23
5.4.60.0170.04716.13
5.4.50.0170.04716.26
5.4.40.0170.05016.27
5.4.30.0170.05016.24
5.4.20.0230.04316.22
5.4.10.0100.05316.15
5.4.00.0100.05315.64
5.3.290.0200.05314.70
5.3.280.0170.05314.62
5.3.270.0200.05714.74
5.3.260.0200.06014.83
5.3.250.0270.06714.71
5.3.240.0170.06314.63
5.3.230.0200.05014.65
5.3.220.0200.05014.70
5.3.210.0230.04714.73
5.3.200.0170.05014.59
5.3.190.0200.04714.77
5.3.180.0130.05714.74
5.3.170.0200.05014.80
5.3.160.0100.06014.60
5.3.150.0200.04714.58
5.3.140.0200.04714.73
5.3.130.0170.06014.65
5.3.120.0170.05314.67
5.3.110.0230.05314.73
5.3.100.0130.05314.07
5.3.90.0330.03714.08
5.3.80.0200.04714.14
5.3.70.0030.06314.04
5.3.60.0170.05313.98
5.3.50.0270.06314.05
5.3.40.0300.06013.93
5.3.30.0330.05014.13
5.3.20.0130.06313.81
5.3.10.0270.04013.73
5.3.00.0170.05013.73
5.2.170.0100.04311.31
5.2.160.0100.04711.28
5.2.150.0170.04011.13
5.2.140.0170.04011.12
5.2.130.0100.05311.25
5.2.120.0100.04311.05
5.2.110.0130.04311.05
5.2.100.0200.03311.09
5.2.90.0170.03711.05
5.2.80.0230.04711.14
5.2.70.0130.04311.10
5.2.60.0070.04711.20
5.2.50.0170.03710.96
5.2.40.0100.04310.96
5.2.30.0130.04010.95
5.2.20.0070.04310.99
5.2.10.0170.04710.91
5.2.00.0200.03310.69
5.1.60.0130.03310.03
5.1.50.0100.03310.11
5.1.40.0070.0379.97
5.1.30.0100.03710.34
5.1.20.0070.04710.32
5.1.10.0070.04010.12
5.1.00.0200.03010.20
5.0.50.0070.0308.61
5.0.40.0000.0408.44
5.0.30.0100.0438.25
5.0.20.0070.0308.29
5.0.10.0130.0238.29
5.0.00.0100.0408.34
4.4.90.0030.0235.87
4.4.80.0130.0135.85
4.4.70.0070.0205.91
4.4.60.0170.0105.90
4.4.50.0030.0335.90
4.4.40.0070.0435.87
4.4.30.0130.0235.89
4.4.20.0000.0275.95
4.4.10.0130.0175.96
4.4.00.0030.0375.93
4.3.110.0030.0235.86
4.3.100.0070.0205.80
4.3.90.0030.0235.80
4.3.80.0100.0375.80
4.3.70.0070.0205.89
4.3.60.0000.0235.82
4.3.50.0030.0235.79
4.3.40.0070.0375.73
4.3.30.0000.0234.57
4.3.20.0100.0174.66
4.3.10.0030.0274.49
4.3.00.0000.0237.59

preferences:
139.05 ms | 1394 KiB | 7 Q