3v4l.org

run code in 300+ PHP versions simultaneously
<?php function query($query) { if(strpos($query, 'WHERE') !== false) { $new = $this->prepare_where($query); $query = $new['query']; $values = $new['values']; } else { $new = NULL; $values = array(); } var_dump($query, $new); } function prepare_where($query) { $strpos_where = strpos($query, 'WHERE') + 6; $strpos_limit = (int) strpos($query, 'LIMIT'); $strpos_group = (int) strpos($query, 'GROUP BY'); $strpos_order = (int) strpos($query, 'ORDER BY'); $new_query = substr($query, 0, $strpos_where); if($strpos_limit > 0 AND $strpos_limit < $strpos_group AND $strpos_limit < $strpos_order) { $where = substr($query, $strpos_where, $strpos_limit); $new_subquery = substr($query, $strpos_limit); } elseif($strpos_group > 0 AND $strpos_group < $strpos_limit AND $strpos_group < $strpos_order) { $where = substr($query, $strpos_where, $strpos_group); $new_subquery = substr($query, $strpos_group); } elseif($strpos_order > 0 AND $strpos_order < $strpos_limit AND $strpos_order < $strpos_group) { $where = substr($query, $strpos_where, $strpos_order); $new_subquery = substr($query, $strpos_order); } else { $where = substr($query, $strpos_where); $new_subquery = ""; } $where_values = array(); $where_break = explode(' AND ', $where); $where_break_c = count($where_break); for($i = 0; $i < $where_break_c; $i++) { if(!isset($where_break[$i])) { continue; } if(isset($where_break[$i + 1]) AND preg_match('/([\`a-z0-9\_\-]+)[\s]{0,1}(\=|LIKE|\<|\>|\<\=|\>\=|!\=)[\s]{0,1}(.*)/i', $where_break[$i + 1]) != 1) { $where_break[$i] = $where_break[$i]." AND ".$where_break[$i + 1]; unset($where_break[$i + 1]); } $where_break_or = explode(' OR ', $where_break[$i]); $where_break_or_c = count($where_break_or); for($j = 0; $j < $where_break_or_c; $j++) { if(!isset($where_break_or[$i])) { continue; } if(isset($where_break_or[$j + 1]) AND preg_match('/([\`a-z0-9\_\-]+)[\s]{0,1}(\=|LIKE|\<|\>|\<\=|\>\=|!\=)[\s]{0,1}(.*)/i', $where_break_or[$j + 1]) != 1) { $where_break_or[$j] = $where_break_or[$j]." OR ".$where_break_or[$j + 1]; unset($where_break_or[$j + 1]); } preg_match('/([\`a-z0-9\_\-]+)[\s]{0,1}(\=|LIKE|\<|\>|\<\=|\>\=|!\=)[\s]{0,1}(.*)/i', $where_break_or[$j], $matches); if(substr($matches[3], 0, 1) == "'" OR substr($matches[3], 0, 1) == '"') { $where_values[] = substr($matches[3], 1, -1); } else { $where_values[] = $matches[3]; } $where_break_or[$j] = str_replace($matches[3], '?', $where_break_or[$j]); } $where_break[$i] = implode(' OR ', $where_break_or); preg_match('/([\`a-z0-9\_\-]+)[\s]{0,1}(\=|LIKE|\<|\>|\<\=|\>\=|!\=)[\s]{0,1}(.*)/i', $clausel2, $matches); if(substr($matches[3], 0, 1) == "'" OR substr($matches[3], 0, 1) == '"') { $matches[3] = substr($matches[3], 1, -1); } $where_values[] = $matches[3]; $where_break[$i] = str_replace($matches[3], '?', $where_break[$i]); } $where_break = implode(' AND ', $where_break); $new_query .= $where_break.$new_subquery; return array('query' => $new_query, 'values' => $where_values); } query("SELECT TABLE FROM FZC WHERE TABLE='chandz' AND TABLE=1 OR DIE='52'"); query("SELECT TABLE FROM FZC WHERE TABLE='chandz AND ' AND TABLE=1 OR DIE='52 OR '");

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.0160.00722.05
8.3.40.0040.01118.88
8.3.30.0040.01118.82
8.3.20.0020.00520.33
8.3.10.0030.00620.39
8.3.00.0030.00621.73
8.2.180.0120.00416.63
8.2.170.0160.00722.96
8.2.160.0070.00721.91
8.2.150.0040.00424.18
8.2.140.0040.00424.66
8.2.130.0040.00421.03
8.2.120.0040.00426.35
8.2.110.0050.00520.25
8.2.100.0090.00317.78
8.2.90.0000.00818.98
8.2.80.0000.00917.97
8.2.70.0030.00617.63
8.2.60.0000.00817.80
8.2.50.0040.00418.09
8.2.40.0080.00020.47
8.2.30.0040.00419.37
8.2.20.0000.00717.76
8.2.10.0050.00218.18
8.2.00.0000.00817.98
8.1.280.0060.00925.92
8.1.270.0050.00322.14
8.1.260.0040.00428.09
8.1.250.0080.00028.09
8.1.240.0060.00322.13
8.1.230.0090.00320.97
8.1.220.0040.00417.74
8.1.210.0050.00318.77
8.1.200.0100.00017.25
8.1.190.0040.00417.35
8.1.180.0000.00818.10
8.1.170.0050.00518.71
8.1.160.0050.00220.66
8.1.150.0000.00718.83
8.1.140.0000.00819.56
8.1.130.0080.00017.64
8.1.120.0040.00417.39
8.1.110.0030.00617.30
8.1.100.0070.00017.29
8.1.90.0080.00017.42
8.1.80.0070.00017.30
8.1.70.0000.00717.40
8.1.60.0070.00417.49
8.1.50.0030.00617.52
8.1.40.0050.00317.49
8.1.30.0000.00817.64
8.1.20.0050.00317.52
8.1.10.0040.00417.61
8.1.00.0080.00017.44
8.0.300.0040.00418.77
8.0.290.0040.00417.00
8.0.280.0030.00318.41
8.0.270.0030.00317.17
8.0.260.0000.00717.13
8.0.250.0030.00316.90
8.0.240.0000.00817.02
8.0.230.0040.00416.93
8.0.220.0040.00416.95
8.0.210.0030.00417.00
8.0.200.0050.00317.02
8.0.190.0000.00817.06
8.0.180.0000.00716.98
8.0.170.0080.00016.99
8.0.160.0040.00416.85
8.0.150.0000.00716.77
8.0.140.0040.00416.95
8.0.130.0030.00313.34
8.0.120.0000.00816.95
8.0.110.0050.00216.89
8.0.100.0000.00816.77
8.0.90.0050.00316.91
8.0.80.0100.01016.88
8.0.70.0040.00416.99
8.0.60.0000.00716.85
8.0.50.0040.00416.85
8.0.30.0110.00717.19
8.0.20.0130.00617.40
8.0.10.0050.00216.87
8.0.00.0120.00616.74
7.4.330.0000.00516.67
7.4.320.0030.00316.62
7.4.300.0060.00016.61
7.4.290.0000.00716.61
7.4.280.0080.00016.64
7.4.270.0040.00416.53
7.4.260.0020.00716.58
7.4.250.0050.00216.37
7.4.240.0050.00216.50
7.4.230.0070.00016.61
7.4.220.0060.01616.67
7.4.210.0100.00616.65
7.4.200.0000.00716.40
7.4.160.0000.01616.38
7.4.150.0130.00517.40
7.4.140.0100.01117.86
7.4.130.0100.01016.71
7.4.120.0060.01116.57
7.4.110.0110.00516.50
7.4.100.0110.01416.52
7.4.90.0110.00716.71
7.4.80.0070.01419.39
7.4.70.0100.00716.88
7.4.60.0070.01016.41
7.4.50.0110.00616.59
7.4.40.0100.01316.59
7.4.30.0120.00416.56
7.4.00.0000.01115.25
7.3.330.0050.00013.31
7.3.320.0000.00513.20
7.3.310.0070.00016.34
7.3.300.0040.00416.38
7.3.290.0000.00716.32
7.3.280.0070.01316.37
7.3.270.0100.01417.40
7.3.260.0140.00416.52
7.3.250.0130.00516.45
7.3.240.0110.00616.48
7.3.230.0110.00716.42
7.3.210.0130.00316.48
7.3.200.0070.01116.44
7.3.190.0060.01016.40
7.3.180.0100.00616.44
7.3.170.0130.00516.53
7.3.160.0100.01016.56
7.2.330.0140.00416.87
7.2.320.0090.01516.44
7.2.310.0100.00716.82
7.2.300.0150.00316.66
7.2.290.0040.01216.73
7.2.60.0000.01516.59
7.2.00.0080.00819.19
7.1.200.0080.00415.81
7.1.100.0030.01017.70
7.1.70.0060.00917.19
7.1.60.0170.00719.27
7.1.50.0070.01316.98
7.1.00.0030.07722.40
7.0.200.0210.00014.81
7.0.60.0270.07319.91
7.0.50.0200.06717.93
7.0.40.0170.08020.11
7.0.30.0170.04020.19
7.0.20.0230.08020.15
7.0.10.0100.04320.19
7.0.00.0100.07320.22
5.6.280.0070.05020.96
5.6.210.0030.07720.60
5.6.200.0130.07318.21
5.6.190.0170.07720.63
5.6.180.0100.04720.41
5.6.170.0170.04320.59
5.6.160.0100.08320.46
5.6.150.0100.03318.20
5.6.140.0070.04018.18
5.6.130.0030.04018.23
5.6.120.0200.07021.19
5.6.110.0070.08021.08
5.6.100.0070.07321.00
5.6.90.0030.09020.90
5.6.80.0030.07720.46
5.5.350.0230.07320.44
5.5.340.0030.04018.07
5.5.330.0100.03320.32
5.5.320.0300.04720.31
5.5.310.0230.04320.41
5.5.300.0000.04718.10
5.5.290.0030.04717.99
5.5.280.0030.06320.92
5.5.270.0130.03320.84
5.5.260.0100.06720.84
5.5.250.0070.07720.82
5.5.240.0070.02720.08

preferences:
54.1 ms | 401 KiB | 5 Q