3v4l.org

run code in 300+ PHP versions simultaneously
<?php $keys = array('SELECT','FROM','WHERE','LEFT','ORDER'); $sql = "Select id, nome FROM table as t WHERE t.id = 123 LEFT JOIN t2 ON t2.id = t.id ORDER BY t.name "; $str = preg_replace('!\s+!', ' ', $sql); $arr = explode(' ', $str); $j = -1; $out = []; for ($i = 0; $i < count($arr); $i++) { if (in_array(strtoupper($arr[$i]), $keys)) { $j++; $out[$j][0] = $arr[$i]; $out[$j][1] = ''; continue; } if ($j > -1) { $out[$j][1] = $out[$j][1] . $arr[$i] . ' '; } } var_dump($out);

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.3.60.0090.00616.63
8.3.50.0150.00016.62
8.3.40.0070.00719.04
8.3.30.0070.00718.79
8.3.20.0040.00421.75
8.3.10.0040.00421.73
8.3.00.0090.00019.77
8.2.180.0070.01416.62
8.2.170.0110.00322.96
8.2.160.0120.00619.46
8.2.150.0080.00824.18
8.2.140.0050.00324.66
8.2.130.0110.00720.52
8.2.120.0070.00026.35
8.2.110.0060.00322.24
8.2.100.0110.00317.97
8.2.90.0040.00417.75
8.2.80.0030.00519.05
8.2.70.0040.00417.63
8.2.60.0030.00617.75
8.2.50.0000.00818.05
8.2.40.0040.00418.28
8.2.30.0000.00818.16
8.2.20.0030.00518.20
8.2.10.0000.00818.15
8.2.00.0000.00718.13
8.1.280.0120.00325.92
8.1.270.0060.00323.96
8.1.260.0030.00526.35
8.1.250.0000.00928.09
8.1.240.0100.00317.61
8.1.230.0080.00322.25
8.1.220.0040.00417.74
8.1.210.0030.00518.77
8.1.200.0030.00617.48
8.1.190.0050.00317.47
8.1.180.0000.00818.10
8.1.170.0040.00418.83
8.1.160.0030.00618.87
8.1.150.0040.00418.92
8.1.140.0040.00419.60
8.1.130.0040.00418.82
8.1.120.0000.00717.51
8.1.110.0050.00317.54
8.1.100.0040.00417.59
8.1.90.0040.00417.58
8.1.80.0040.00417.53
8.1.70.0000.00817.66
8.1.60.0060.00317.74
8.1.50.0050.00317.63
8.1.40.0060.00317.55
8.1.30.0030.00617.71
8.1.20.0050.00317.77
8.1.10.0000.00817.57
8.1.00.0080.00017.48
8.0.300.0050.00318.77
8.0.290.0030.00616.88
8.0.280.0090.00018.38
8.0.270.0000.00817.33
8.0.260.0000.00718.95
8.0.250.0040.00417.08
8.0.240.0050.00317.13
8.0.230.0080.00017.14
8.0.220.0040.00416.99
8.0.210.0030.00417.10
8.0.200.0030.00317.00
8.0.190.0040.00417.13
8.0.180.0070.00017.00
8.0.170.0070.00017.14
8.0.160.0000.00816.94
8.0.150.0040.00417.05
8.0.140.0000.00717.03
8.0.130.0000.00613.43
8.0.120.0040.00417.02
8.0.110.0050.00316.84
8.0.100.0060.00316.86
8.0.90.0000.00717.09
8.0.80.0090.00817.03
8.0.70.0040.00417.15
8.0.60.0050.00217.09
8.0.50.0040.00417.02
8.0.30.0080.00917.07
8.0.20.0150.00717.44
8.0.10.0040.00417.03
8.0.00.0030.01416.95
7.4.330.0000.00615.55
7.4.320.0000.00616.82
7.4.300.0020.00516.73
7.4.290.0080.00416.81
7.4.280.0060.00316.73
7.4.270.0000.00716.72
7.4.260.0040.00416.60
7.4.250.0000.00716.62
7.4.240.0070.00016.71
7.4.230.0000.00716.91
7.4.220.0070.01116.88
7.4.210.0080.00816.72
7.4.200.0000.00716.79
7.4.160.0090.01016.74
7.4.150.0090.00917.40
7.4.140.0070.01417.86
7.4.130.0120.00816.51
7.4.120.0110.00916.69
7.4.110.0060.01216.63
7.4.100.0090.00916.56
7.4.90.0070.01016.82
7.4.80.0040.01519.39
7.4.70.0100.00616.70
7.4.60.0090.00916.54
7.4.50.0080.00416.38
7.4.40.0060.01116.61
7.4.30.0100.00616.54
7.4.10.0110.00714.99
7.4.00.0140.00314.95
7.3.330.0000.00713.37
7.3.320.0000.00513.31
7.3.310.0000.00816.53
7.3.300.0000.00716.30
7.3.290.0070.00016.33
7.3.280.0090.00816.45
7.3.270.0060.01617.40
7.3.260.0090.01116.74
7.3.250.0130.00816.58
7.3.240.0140.00616.74
7.3.230.0170.00016.48
7.3.210.0140.00316.51
7.3.200.0030.01316.63
7.3.190.0030.01316.78
7.3.180.0160.00616.53
7.3.170.0070.01116.54
7.3.160.0080.01216.42
7.3.130.0090.00914.99
7.3.120.0100.01015.27
7.3.110.0140.00015.16
7.3.100.0040.01114.88
7.3.90.0030.01015.07
7.3.80.0080.00315.16
7.3.70.0030.01114.97
7.3.60.0030.01014.85
7.3.50.0030.01015.00
7.3.40.0040.01114.89
7.3.30.0090.00915.09
7.3.20.0000.01716.83
7.3.10.0070.01016.66
7.3.00.0040.01516.86
7.2.330.0150.00316.76
7.2.320.0110.00616.91
7.2.310.0090.01516.78
7.2.300.0140.00316.79
7.2.290.0050.01116.74
7.2.260.0030.01415.33
7.2.250.0060.01015.34
7.2.240.0110.00315.21
7.2.230.0070.00715.33
7.2.220.0090.00615.18
7.2.210.0000.01415.08
7.2.200.0040.01215.23
7.2.190.0090.00615.42
7.2.180.0070.01015.02
7.2.170.0060.00914.99
7.2.160.0040.01515.19
7.2.150.0070.01116.87
7.2.140.0060.00917.01
7.2.130.0040.00817.12
7.2.120.0090.00317.06
7.2.110.0040.01116.79
7.2.100.0100.00317.04
7.2.90.0040.00917.16
7.2.80.0000.01517.29
7.2.70.0060.00616.92
7.2.60.0070.00917.10
7.2.50.0090.00617.11
7.2.40.0090.00917.19
7.2.30.0030.01317.16
7.2.20.0030.01417.14
7.2.10.0070.00716.84
7.2.00.0070.00717.14
7.1.330.0000.01715.91
7.1.320.0060.00916.15
7.1.310.0040.00815.94
7.1.300.0060.01016.14
7.1.290.0030.01016.04
7.1.280.0000.01315.85
7.1.270.0060.01015.97
7.1.260.0070.00715.88
7.1.250.0030.01215.89
7.1.240.0120.00315.79
7.1.230.0070.00315.90
7.1.220.0070.00716.09
7.1.210.0130.00015.95
7.1.200.0040.00916.02
7.1.190.0090.00315.82
7.1.180.0000.01515.74
7.1.170.0000.01516.18
7.1.160.0060.01215.80
7.1.150.0070.01016.09
7.1.140.0000.01815.97
7.1.130.0110.00415.86
7.1.120.0040.00815.91
7.1.110.0090.00315.98
7.1.100.0150.00016.13
7.1.90.0140.00316.13
7.1.80.0070.00316.13
7.1.70.0110.00616.66
7.1.60.0060.00816.60
7.1.50.0250.01724.66
7.1.40.0250.00824.36
7.1.30.0330.01024.27
7.1.20.0180.01224.35
7.1.10.0120.01215.46
7.1.00.0170.00615.50
7.0.330.0110.00015.68
7.0.320.0110.00415.50
7.0.310.0030.00515.45
7.0.300.0110.00415.64
7.0.290.0120.00015.62
7.0.280.0070.00315.54
7.0.270.0060.00915.57
7.0.260.0030.00915.49
7.0.250.0000.01215.82
7.0.240.0060.00915.38
7.0.230.0100.00715.80
7.0.220.0040.00715.70
7.0.210.0090.00315.41
7.0.200.0070.00916.10
7.0.190.0230.00915.38
7.0.180.0220.00215.19
7.0.170.0250.00514.89
7.0.160.0170.00915.11
7.0.150.0150.00815.09
7.0.140.0180.00815.20
7.0.130.0130.00815.29
7.0.120.0130.01015.11
7.0.110.0190.00815.11
7.0.100.0150.00915.10
7.0.90.0150.00815.00
7.0.80.0160.00815.04
7.0.70.0150.01415.04
7.0.60.0100.01214.97
7.0.50.0380.00515.10
7.0.40.0150.00514.15
7.0.30.0190.00914.19
7.0.20.0100.01314.34
7.0.10.0120.01014.18
7.0.00.0150.00714.09
5.6.400.0060.01314.35
5.6.390.0100.00314.50
5.6.380.0070.01014.73
5.6.370.0100.00314.77
5.6.360.0100.00014.83
5.6.350.0040.01114.75
5.6.340.0090.00614.91
5.6.330.0070.01014.85
5.6.320.0000.01414.46
5.6.310.0100.00314.75
5.6.300.0030.00914.25
5.6.290.0000.01214.46
5.6.280.0000.00914.38
5.6.270.0030.01014.92
5.6.260.0090.00314.67
5.6.250.0000.01214.52
5.6.240.0040.00714.39
5.6.230.0030.00614.64
5.6.220.0130.00314.41
5.6.210.0120.00314.41
5.6.200.0030.00714.34
5.6.190.0040.01114.43
5.6.180.0040.00814.46
5.6.170.0030.01014.56
5.6.160.0060.00914.45
5.6.150.0130.00714.49
5.6.140.0070.01014.55
5.6.130.0100.01014.73
5.6.120.0000.01214.57
5.6.110.0060.00614.43
5.6.100.0000.01314.44
5.6.90.0060.00614.63
5.6.80.0140.00014.43
5.6.70.0060.01014.28
5.6.60.0140.00314.39
5.6.50.0040.01514.43
5.6.40.0110.00714.51
5.6.30.0030.01114.83
5.6.20.0030.00714.48
5.6.10.0000.01414.31
5.6.00.0030.00914.41

preferences:
34.92 ms | 400 KiB | 5 Q