3v4l.org

run code in 300+ PHP versions simultaneously
<?php function random_index(array $source) { $max = count($source) - 1; $r = random_int(0, $max); $k = array_keys($source); return $k[$r]; } $array = [ 'apple' => 1234, 'boy' => 2345, 'cat' => 3456, 'dog' => 4567, 'echo' => 5678, 'fortune' => 6789 ]; $i = random_index($array); var_dump([$i, $array[$i]]);

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)
8.2.70.0130.00579.33
8.2.60.0080.00648.69
8.2.50.0140.00448.35
8.2.40.0150.00248.35
8.2.30.0090.00748.41
8.2.20.0070.00538.23
8.2.10.0090.00838.08
8.2.00.0100.00638.23
8.1.200.0170.00079.33
8.1.190.0130.00448.29
8.1.180.0150.00348.10
8.1.170.0140.00348.23
8.1.160.0130.00448.16
8.1.150.0120.00637.88
8.1.140.0120.00637.84
8.1.130.0110.00638.04
8.1.120.0100.00532.93
8.1.110.0110.00432.86
8.1.100.0120.00532.90
8.1.90.0090.00425.08
8.1.80.0090.00627.69
8.1.70.0090.00627.73
8.1.60.0100.00727.76
8.1.50.0110.00827.72
8.1.40.0130.00527.69
8.1.30.0150.00327.79
8.1.20.0130.00627.76
8.1.10.0120.00527.77
8.1.00.0110.00627.67
8.0.290.0160.00079.33
8.0.280.0160.00047.92
8.0.270.0120.00537.57
8.0.260.0150.00137.56
8.0.250.0110.00532.40
8.0.240.0090.00532.40
8.0.230.0120.00432.39
8.0.220.0120.00427.09
8.0.210.0110.00427.12
8.0.200.0110.00327.47
8.0.190.0070.00727.45
8.0.180.0110.00427.08
8.0.170.0120.00427.20
8.0.160.0120.00427.07
8.0.150.0080.00624.52
8.0.140.0100.00527.15
8.0.130.0130.00327.07
8.0.120.0080.00522.51
8.0.110.0100.00525.20
8.0.100.0110.00425.19
8.0.90.0090.00625.15
8.0.80.0120.00325.17
8.0.70.0120.00425.14
8.0.60.0110.00425.17
8.0.50.0110.00425.15
8.0.30.0070.00822.13
8.0.20.0080.00921.75
8.0.10.0080.00821.85
8.0.00.0080.00721.87
7.4.330.0070.00431.74
7.4.320.0040.00519.63
7.4.300.0090.00421.79
7.4.290.0120.00326.93
7.4.280.0100.00626.97
7.4.270.0100.00526.97
7.4.260.0080.00926.96
7.4.250.0090.00625.00
7.4.240.0110.00424.99
7.4.230.0100.00525.04
7.4.220.0100.00424.97
7.4.210.0120.00225.02
7.4.200.0080.00724.97
7.4.190.0090.00525.05
7.4.180.0090.00525.04
7.4.160.0100.00621.94
7.4.150.0110.00521.51
7.4.140.0080.00821.49
7.4.130.0090.00721.50
7.4.120.0080.00721.07
7.4.110.0120.00421.06
7.4.100.0110.00720.74
7.4.90.0100.00820.81
7.4.80.0110.00720.77
7.4.70.0100.00720.75
7.4.60.0110.00620.76
7.4.50.0090.00720.72
7.4.40.0120.00620.74
7.4.30.0100.00720.77
7.4.20.0110.00720.76
7.4.10.0100.00720.74
7.4.00.0090.00620.83
7.3.330.0110.00526.92
7.3.320.0120.00424.92
7.3.310.0110.00424.95
7.3.300.0090.00624.92
7.3.290.0090.00624.94
7.3.280.0090.00524.96
7.3.270.0120.00521.42
7.3.260.0120.00421.44
7.3.250.0110.00521.39
7.3.240.0100.00621.03
7.3.230.0110.00621.02
7.3.220.0110.00620.69
7.3.210.0090.00820.69
7.3.200.0120.00720.67
7.3.190.0100.00720.70
7.3.180.0110.00620.69
7.3.170.0110.00620.66
7.3.160.0130.00520.67
7.3.150.0120.00620.71
7.3.140.0120.00620.70
7.3.130.0120.00620.68
7.3.120.0100.00620.70
7.3.110.0110.00720.63
7.3.100.0100.00720.67
7.3.90.0100.00720.84
7.3.80.0100.00620.26
7.3.70.0120.00720.35
7.3.60.0090.00720.36
7.3.50.0100.00620.36
7.3.40.0100.00620.03
7.3.30.0100.00820.02
7.3.20.0130.00819.94
7.3.10.0160.00619.66
7.3.00.0160.00719.73
7.2.340.0140.00521.11
7.2.330.0140.00720.78
7.2.320.0120.00820.79
7.2.310.0120.00820.76
7.2.300.0170.00820.74
7.2.290.0150.00620.75
7.2.280.0140.00820.76
7.2.270.0130.00920.80
7.2.260.0130.00820.80
7.2.250.0150.00720.76
7.2.240.0140.00620.75
7.2.230.0150.00620.76
7.2.220.0150.00620.75
7.2.210.0130.00820.37
7.2.200.0150.00620.48
7.2.190.0140.00920.46
7.2.180.0140.00720.45
7.2.170.0140.00620.13
7.2.160.0140.00620.12
7.2.150.0220.00620.01
7.2.140.0170.00720.08
7.2.130.0160.00719.95
7.2.120.0170.00719.89
7.2.110.0190.00519.90
7.2.100.0170.00619.93
7.2.90.0360.00719.61
7.2.80.0380.00619.60
7.2.70.0350.00819.61
7.2.60.0300.00719.66
7.2.50.0340.00719.61
7.2.40.0310.00819.63
7.2.30.0300.00719.50
7.2.20.0270.00819.49
7.2.10.0310.00619.48
7.2.00.0300.00819.45
7.1.330.0150.00620.37
7.1.320.0140.00520.36
7.1.310.0150.00519.97
7.1.300.0150.00619.90
7.1.290.0140.00719.94
7.1.280.0170.00619.65
7.1.270.0140.00819.63
7.1.260.0160.00619.63
7.1.250.0230.00519.04
7.1.240.0190.00619.05
7.1.230.0200.00419.11
7.1.220.0160.00719.12
7.1.210.0170.00718.84
7.1.200.0310.00718.82
7.1.190.0370.00618.84
7.1.180.0350.00618.79
7.1.170.0310.00618.80
7.1.160.0290.00818.76
7.1.150.0300.00718.71
7.1.140.0270.00918.64
7.1.130.0290.00618.60
7.1.120.0300.00618.65
7.1.110.0280.00718.57
7.1.100.0260.00718.57
7.1.90.0280.00718.64
7.1.80.0270.00718.63
7.1.70.0240.00718.49
7.1.60.0340.00721.16
7.1.50.0280.00621.09
7.1.40.0230.00821.07
7.1.30.0240.00921.05
7.1.20.0280.00721.06
7.1.10.0200.00718.47
7.1.00.0200.00718.52
7.0.330.0170.00718.93
7.0.320.0220.00618.92
7.0.310.0330.00618.63
7.0.300.0320.00718.63
7.0.290.0300.00818.62
7.0.280.0340.00618.64
7.0.270.0300.00718.45
7.0.260.0330.00718.45
7.0.250.0280.00818.44
7.0.240.0270.00718.44
7.0.230.0310.00618.44
7.0.220.0260.00918.34
7.0.210.0400.00718.26
7.0.200.0250.00518.30
7.0.190.0240.00718.29
7.0.180.0340.00518.25
7.0.170.0200.00718.28
7.0.160.0220.00618.26
7.0.150.0200.00618.26
7.0.140.0190.00718.28
7.0.130.0200.00618.29
7.0.120.0190.00818.29
7.0.110.0190.00818.24
7.0.100.0210.00718.27
7.0.90.0190.00818.25
7.0.80.0170.00818.24
7.0.70.0250.00618.34
7.0.60.0190.00718.32
7.0.50.0170.00818.35
7.0.40.0170.00718.24
7.0.30.0230.00718.31
7.0.20.0230.00718.16
7.0.10.0360.00718.31
7.0.00.0190.00718.27
5.6.400.0130.00819.54
5.6.390.0130.00719.55
5.6.380.0130.00718.99
5.6.370.0120.00718.92
5.6.360.0140.00718.97
5.6.350.0140.00718.94
5.6.340.0130.00818.96
5.6.330.0110.00918.96
5.6.320.0140.00718.95
5.6.310.0120.00818.96
5.6.300.0130.01218.89
5.6.290.0140.01218.92
5.6.280.0140.01218.96
5.6.270.0150.01318.89
5.6.260.0140.01418.86
5.6.250.0120.01518.90
5.6.240.0120.01418.96
5.6.230.0130.01518.92
5.6.220.0140.01218.94
5.6.210.0140.01218.94
5.6.200.0140.01419.01
5.6.190.0150.01518.98
5.6.180.0130.01418.96
5.6.170.0140.01218.95
5.6.160.0140.01318.96
5.6.150.0130.01318.95
5.6.140.0140.01418.93
5.6.130.0140.01218.93
5.6.120.0130.01418.93
5.6.110.0130.01218.85
5.6.100.0130.01418.92
5.6.90.0140.01218.86
5.6.80.0130.01318.81
5.6.70.0140.01318.85
5.6.60.0130.01318.84
5.6.50.0140.01118.80
5.6.40.0100.01518.84
5.6.30.0120.01418.85
5.6.20.0120.01418.83
5.6.10.0120.01318.83
5.6.00.0120.01318.82
5.5.380.0130.01218.20
5.5.370.0140.01118.17
5.5.360.0140.01118.14
5.5.350.0130.01218.06
5.5.340.0120.01418.16
5.5.330.0140.01218.19
5.5.320.0130.01418.19
5.5.310.0150.01218.19
5.5.300.0120.01318.19
5.5.290.0120.01318.17
5.5.280.0130.01318.20
5.5.270.0110.01318.14
5.5.260.0130.01318.16
5.5.250.0120.01218.16
5.5.240.0130.01318.06
5.5.230.0140.01118.06
5.5.220.0120.01118.11
5.5.210.0130.01118.11
5.5.200.0110.01218.06
5.5.190.0140.01318.08
5.5.180.0130.01118.07
5.5.170.0130.00718.26
5.5.160.0130.01318.08
5.5.150.0120.01518.01
5.5.140.0120.01217.95
5.5.130.0130.01317.99
5.5.120.0140.01317.97
5.5.110.0140.01118.03
5.5.100.0120.01218.05
5.5.90.0130.01118.06
5.5.80.0130.01218.08
5.5.70.0130.01418.11
5.5.60.0150.01118.09
5.5.50.0130.01218.04
5.5.40.0130.01118.08
5.5.30.0120.01318.06
5.5.20.0130.01218.08
5.5.10.0120.01218.05
5.5.00.0120.01318.02

preferences:
31.99 ms | 403 KiB | 5 Q