3v4l.org

run code in 300+ PHP versions simultaneously
<?php /** * Tokenizes text that looks something like SQL. */ function tokenizeSQL( $SQL ) { $functions = array ( 'concat', 'if' ); $token = '\\(|\\)|[\']|"|\140|[*]|,|<|>|<>|=|[+]'; $terminal = $token.'|;| |\\n'; $result = array(); $string = $SQL; $string = ltrim($string); $string = rtrim($string,';').';'; // always ends with a terminal $string = preg_replace( "/[\n\r]/s", ' ', $string ); while( preg_match( "/^($token)($terminal)/s", $string, $matches ) || preg_match( "/^({$token})./s", $string, $matches ) || preg_match( "/^([a-zA-Z0-9_.]+?)($terminal)/s", $string, $matches) ) { $t = $matches[1]; if ($t=='\'') { // it's a string $t = tokSingleQuoteString( $string ); array_push($result, $t); } else if ($t=="\140") { // it's a backtick string (a name) $t = tokBackQuoteString( $string ); array_push($result, $t); } else if ($t=='"') { // it's a double quoted string (a name in normal sql) $t = tokDoubleQuoteString( $string ); array_push($result, $t); } else { array_push($result, $t); } $string = substr( $string, strlen($t) ); $string = ltrim($string); } return $result; } function tokSingleQuoteString( $string ) { // matches a single-quoted string in $string // $string starts with a single quote preg_match('/^(\'.*?\').*$/s', $string, $matches ); return $matches[1]; } function tokBackQuoteString( $string ) { // matches a back-quoted string in $string // $string starts with a back quote preg_match('/^([\140].*?[\140]).*$/s', $string, $matches ); return $matches[1]; } function tokDoubleQuoteString( $string ) { // matches a back-quoted string in $string // $string starts with a back quote preg_match('/^(".*?").*$/s', $string, $matches ); return $matches[1]; } print "<pre>"; print_r(tokenizeSQL('SELECT name, rew from asdf ')); print "</pre>";

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.0100.01018.56
8.3.50.0090.01221.27
8.3.40.0060.00919.07
8.3.30.0070.01420.34
8.3.20.0040.00420.43
8.3.10.0080.00022.04
8.3.00.0090.00622.48
8.2.180.0090.00618.40
8.2.170.0170.00322.96
8.2.160.0040.01122.33
8.2.150.0080.00024.18
8.2.140.0090.00624.66
8.2.130.0000.00726.16
8.2.120.0080.00020.88
8.2.110.0070.00321.10
8.2.100.0110.00017.97
8.2.90.0000.00819.39
8.2.80.0030.00517.97
8.2.70.0090.00417.50
8.2.60.0000.00818.03
8.2.50.0000.00818.07
8.2.40.0040.00418.28
8.2.30.0000.00719.50
8.2.20.0000.00917.91
8.2.10.0020.00517.86
8.2.00.0030.00717.99
8.1.280.0210.00025.92
8.1.270.0000.00823.99
8.1.260.0070.00726.35
8.1.250.0080.00028.09
8.1.240.0030.00721.44
8.1.230.0040.00719.20
8.1.220.0090.00017.79
8.1.210.0030.00518.77
8.1.200.0000.00917.60
8.1.190.0030.00617.60
8.1.180.0080.00018.10
8.1.170.0040.00418.81
8.1.160.0000.01119.08
8.1.150.0040.00418.77
8.1.140.0050.00317.71
8.1.130.0000.00717.92
8.1.120.0040.00417.68
8.1.110.0040.00417.62
8.1.100.0000.00917.64
8.1.90.0080.00017.69
8.1.80.0040.00417.67
8.1.70.0000.00817.52
8.1.60.0040.00417.78
8.1.50.0030.00617.58
8.1.40.0040.00717.71
8.1.30.0040.00417.82
8.1.20.0050.00317.88
8.1.10.0000.00717.75
8.1.00.0030.00517.70
8.0.300.0000.00918.77
8.0.290.0030.00617.00
8.0.280.0000.00718.52
8.0.270.0040.00417.06
8.0.260.0000.00716.93
8.0.250.0050.00217.15
8.0.240.0000.00817.00
8.0.230.0000.00817.17
8.0.220.0040.00417.04
8.0.210.0000.00717.01
8.0.200.0030.00317.05
8.0.190.0080.00017.15
8.0.180.0030.00617.17
8.0.170.0050.00317.03
8.0.160.0000.00716.96
8.0.150.0040.00416.99
8.0.140.0050.00517.02
8.0.130.0060.00013.53
8.0.120.0080.00017.11
8.0.110.0000.00717.13
8.0.100.0040.00417.09
8.0.90.0050.00317.04
8.0.80.0070.01117.13
8.0.70.0060.00317.01
8.0.60.0070.00017.12
8.0.50.0040.00417.02
8.0.30.0100.01017.27
8.0.20.0080.01117.54
8.0.10.0030.00617.26
8.0.00.0110.00916.91
7.4.330.0000.00516.73
7.4.320.0030.00316.74
7.4.300.0000.00616.96
7.4.290.0030.00316.96
7.4.280.0070.00016.81
7.4.270.0070.00016.95
7.4.260.0030.00313.61
7.4.250.0030.00516.86
7.4.240.0040.00316.83
7.4.230.0040.00416.93
7.4.220.0100.00716.82
7.4.210.0060.00816.92
7.4.200.0000.00716.80
7.4.190.0030.00316.63
7.4.160.0130.00316.85
7.4.150.0110.00817.40
7.4.140.0110.00917.86
7.4.130.0080.00916.66
7.4.120.0130.00716.87
7.4.110.0070.01016.72
7.4.100.0130.00716.77
7.4.90.0060.01716.63
7.4.80.0130.00619.39
7.4.70.0080.00816.93
7.4.60.0050.01116.76
7.4.50.0030.00616.91
7.4.40.0000.01622.77
7.4.30.0070.01416.87
7.4.00.0100.00315.29
7.3.330.0050.00013.41
7.3.320.0050.00013.32
7.3.310.0000.00816.55
7.3.300.0070.00016.48
7.3.290.0030.01116.48
7.3.280.0120.00716.62
7.3.270.0120.00617.40
7.3.260.0120.01216.49
7.3.250.0090.01016.72
7.3.240.0090.01216.77
7.3.230.0130.01016.96
7.3.210.0120.01216.90
7.3.200.0070.01119.39
7.3.190.0120.00616.88
7.3.180.0100.00716.65
7.3.170.0160.00016.81
7.3.160.0000.01616.64
7.3.120.0000.01314.95
7.3.10.0070.00716.86
7.3.00.0000.01016.82
7.2.330.0120.00616.98
7.2.320.0130.00316.90
7.2.310.0040.02016.87
7.2.300.0100.01317.02
7.2.290.0060.01016.76
7.2.130.0030.01217.30
7.2.120.0090.00317.25
7.2.110.0060.01316.84
7.2.100.0060.01217.28
7.2.90.0070.01017.25
7.2.80.0090.00617.37
7.2.70.0000.01317.28
7.2.60.0060.01016.89
7.2.50.0040.01217.26
7.2.40.0080.00817.02
7.2.30.0070.01017.06
7.2.20.0080.00816.96
7.2.10.0040.00817.11
7.2.00.0060.00918.24
7.1.250.0100.00315.91
7.1.200.0060.00915.84
7.1.100.0030.00918.30
7.1.70.0040.00417.40
7.1.60.0070.01719.17
7.1.50.0040.01817.23
7.1.00.0070.03322.46
7.0.200.0050.00216.98
7.0.140.0070.07322.10
7.0.70.0300.05319.96
7.0.60.0270.04719.81
7.0.50.0430.04020.26
7.0.40.0100.04020.04
7.0.30.0070.03020.05
7.0.20.0030.03720.10
7.0.10.0070.03320.17
7.0.00.0000.04720.03
5.6.280.0030.07320.93
5.6.220.0030.05320.75
5.6.210.0030.07720.70
5.6.200.0030.04321.13
5.6.190.0070.03321.02
5.6.180.0070.03021.05
5.6.170.0030.03721.03
5.6.160.0030.05021.05
5.6.150.0030.03321.04
5.6.140.0070.03021.02
5.6.130.0030.06721.05
5.6.120.0030.04321.02
5.6.110.0070.04021.14
5.6.100.0100.03021.09
5.6.90.0070.04020.95
5.6.80.0100.03320.51
5.6.70.0100.03320.44
5.6.60.0030.03320.39
5.6.50.0030.04020.48
5.6.40.0070.08020.40
5.6.30.0070.07020.42
5.6.20.0100.07320.37
5.6.10.0100.05720.37
5.6.00.0100.05020.30
5.5.360.0030.04320.48
5.5.350.0000.05020.49
5.5.340.0030.04320.92
5.5.330.0030.05720.93
5.5.320.0000.05720.91
5.5.310.0100.05020.78
5.5.300.0070.03320.84
5.5.290.0030.06320.92
5.5.280.0100.03720.84
5.5.270.0000.04320.88
5.5.260.0000.04320.79
5.5.250.0070.03020.62
5.5.240.0000.03720.30
5.5.230.0070.03720.13
5.5.220.0100.04020.19
5.5.210.0030.03720.32
5.5.200.0070.07720.17
5.5.190.0070.08020.29
5.5.180.0100.07320.16
5.5.160.0170.06320.29
5.5.150.0030.08320.14
5.5.140.0030.08020.27
5.5.130.0070.08020.17
5.5.120.0130.08020.16
5.5.110.0000.08720.26
5.5.100.0100.07020.12
5.5.90.0100.07720.18
5.5.80.0030.07720.13
5.5.70.0100.05719.95
5.5.60.0100.07320.15
5.5.50.0070.07720.10
5.5.40.0100.07720.17
5.5.30.0100.04720.13
5.5.20.0030.04320.06
5.5.10.0100.04720.06
5.5.00.0130.07020.12
5.4.450.0070.04019.46
5.4.440.0100.03719.22
5.4.430.0000.03719.22
5.4.420.0070.06319.44
5.4.410.0130.07719.07
5.4.400.0070.06719.18
5.4.390.0030.03318.97
5.4.380.0000.03318.87
5.4.370.0030.07719.18
5.4.360.0070.08319.20
5.4.350.0030.05019.12
5.4.340.0070.07318.95
5.4.320.0130.08019.13
5.4.310.0070.03719.14
5.4.300.0030.08319.21
5.4.290.0100.05019.04
5.4.280.0100.06718.90
5.4.270.0130.07019.14
5.4.260.0030.05719.05
5.4.250.0070.08018.84
5.4.240.0100.05318.87
5.4.230.0100.04718.84
5.4.220.0030.08719.04
5.4.210.0070.07319.04
5.4.200.0200.06319.11
5.4.190.0070.08019.03
5.4.180.0130.07018.93
5.4.170.0030.07719.11
5.4.160.0100.07018.88
5.4.150.0130.06719.11
5.4.140.0000.04716.48
5.4.130.0000.08316.39
5.4.120.0100.07016.38
5.4.110.0130.04016.39
5.4.100.0070.07016.39
5.4.90.0030.05016.38
5.4.80.0130.04016.40
5.4.70.0130.06716.55
5.4.60.0100.07316.45
5.4.50.0070.07016.34
5.4.40.0030.07316.46
5.4.30.0030.05316.47
5.4.20.0070.06716.30
5.4.10.0200.05716.40
5.4.00.0030.04315.86
5.3.290.0100.04714.74
5.3.280.0070.05714.61
5.3.270.0030.04014.56
5.3.260.0100.04014.71
5.3.250.0130.05714.75
5.3.240.0100.07014.61
5.3.230.0100.05014.68
5.3.220.0130.05714.57
5.3.210.0030.07714.52
5.3.200.0030.06714.58
5.3.190.0070.08314.64
5.3.180.0100.07314.64
5.3.170.0070.06314.65
5.3.160.0030.09314.61
5.3.150.0100.08014.73
5.3.140.0100.04714.54
5.3.130.0070.04314.52
5.3.120.0070.06314.57
5.3.110.0030.06714.52
5.3.100.0030.04014.13
5.3.90.0000.06014.06
5.3.80.0030.04014.10
5.3.70.0030.03713.96
5.3.60.0100.04714.13
5.3.50.0030.08013.93
5.3.40.0070.06014.03
5.3.30.0100.07313.84
5.3.20.0070.07013.61
5.3.10.0200.06313.58
5.3.00.0130.06713.68
5.2.170.0030.05312.20
5.2.160.0070.06012.20
5.2.150.0070.06012.20
5.2.140.0070.06312.20
5.2.130.0130.04312.20
5.2.120.0100.04012.20
5.2.110.0030.04712.20
5.2.100.0130.04712.20
5.2.90.0100.04312.20
5.2.80.0100.05012.20
5.2.70.0030.05012.20
5.2.60.0030.05712.20
5.2.50.0100.05712.20
5.2.40.0100.05712.20
5.2.30.0100.06012.20
5.2.20.0100.06312.20
5.2.10.0070.04712.20
5.2.00.0070.05712.20
5.1.60.0000.03312.20
5.1.50.0000.04012.20
5.1.40.0030.05312.20
5.1.30.0000.06012.20
5.1.20.0070.05712.20
5.1.10.0070.05312.20
5.1.00.0030.05012.20
5.0.50.0070.04312.20
5.0.40.0000.05012.20
5.0.30.0030.05312.20
5.0.20.0070.03012.20
5.0.10.0030.04012.20
5.0.00.0000.07012.20
4.4.90.0000.03712.20
4.4.80.0030.04012.20
4.4.70.0070.03012.20
4.4.60.0030.02312.20
4.4.50.0030.03312.20
4.4.40.0070.05012.20
4.4.30.0070.03312.20
4.4.20.0100.02312.20
4.4.10.0000.03712.20
4.4.00.0100.04312.20
4.3.110.0000.02712.20
4.3.100.0130.01712.20
4.3.90.0030.02712.20
4.3.80.0130.02312.20
4.3.70.0030.02312.20
4.3.60.0070.02712.20
4.3.50.0030.03712.20
4.3.40.0000.05712.20
4.3.30.0000.04012.20
4.3.20.0070.03312.20
4.3.10.0030.03712.20
4.3.00.0030.03012.20

preferences:
51.03 ms | 401 KiB | 5 Q