3v4l.org

run code in 300+ PHP versions simultaneously
<?php //===================================================================================== //Apply real_escape_string to strip out SQL injection function makeSafe($value){ //if (isset($value)){ $value = clean_html($value); $value = strip_tags(trim($value)); //} return $value; //return mysql_real_escape_string($value); } //===================================================================================== //Clean out html code. From html2txt() in http://us2.php.net/manual/en/function.strip-tags.php function clean_html($document){ $search = array( '@<script[^>]*?>.*?</script>@si', // Strip out javascript '@<[\/\!]*?[^<>]*?>@si', // Strip out HTML tags '@<style[^>]*?>.*?</style>@siU', // Strip style tags properly '@<![\s\S]*?--[ \t\n\r]*>@' // Strip multi-line comments including CDATA ); //Replace any of the patterns listed above $text = preg_replace($search, '', $document); //Replace or remove any illegal characters $text = preg_replace('/;/', ' ', $text); //semicolons $text = preg_replace('/"/', "'", $text); //double quotations $text = preg_replace('/[\%\?\*]/', ' ', $text); //wildcards $text = preg_replace('/[\:\`\$\/\\\=\~\<\>\|\!\^]/', ' ', $text); //other uneeded symbols $text = preg_replace('/[-]{2,}/', '-', $text); //more than 1 dash in a row $text = preg_replace("/[\']{2,}/", "'", $text); //more than 1 single quotation in a row $text = preg_replace("/[\&]{2,}/", '&', $text); //more than 1 ampersand in a row $text = preg_replace("/[ ]{2,}/", ' ', $text); //more than 1 space in a row //And replace any leftover special characters $text = htmlspecialchars($text, ENT_QUOTES, 'UTF-8'); //Return the value return $text; } $mystring = " Validating data... Done validating... test 123............stdClass Object ( [feedback_text] => Array ( [text] => Robert'); DROP TABLE Stftudents;--' ? Mom [format] => 1 ) [name] => connor - admin, 2 - john [email] => rcooper@c2ti.com [submitbutton] => Submit Feedback [text_len] => 41 )"; $mystring2 = makeSafe($mystring); echo $mystring2;

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.01318.81
8.3.50.0100.01021.27
8.3.40.0090.00618.96
8.3.30.0040.01218.97
8.3.20.0000.00820.16
8.3.10.0040.00421.63
8.3.00.0040.00417.92
8.2.180.0110.00718.41
8.2.170.0110.00422.96
8.2.160.0030.01020.37
8.2.150.0000.00824.18
8.2.140.0040.00424.66
8.2.130.0080.00026.16
8.2.120.0080.00017.75
8.2.110.0030.00721.16
8.2.100.0090.00318.16
8.2.90.0030.00618.15
8.2.80.0100.00018.04
8.2.70.0040.00417.63
8.2.60.0030.00517.93
8.2.50.0040.00418.07
8.2.40.0030.00619.39
8.2.30.0040.00420.66
8.2.20.0090.00017.96
8.2.10.0000.00718.27
8.2.00.0040.00418.24
8.1.280.0110.00725.92
8.1.270.0030.01622.15
8.1.260.0080.00026.35
8.1.250.0080.00028.09
8.1.240.0120.00622.66
8.1.230.0040.00820.90
8.1.220.0060.00317.74
8.1.210.0000.00818.95
8.1.200.0030.00717.48
8.1.190.0000.00817.48
8.1.180.0030.00618.10
8.1.170.0030.00618.80
8.1.160.0000.00721.90
8.1.150.0000.00718.89
8.1.140.0030.00517.62
8.1.130.0000.00817.61
8.1.120.0070.00017.55
8.1.110.0070.00017.48
8.1.100.0000.00717.60
8.1.90.0050.00217.50
8.1.80.0070.00017.45
8.1.70.0030.00317.47
8.1.60.0050.00317.75
8.1.50.0090.00017.76
8.1.40.0050.00317.58
8.1.30.0080.00017.85
8.1.20.0040.00417.71
8.1.10.0000.00817.56
8.1.00.0000.00817.60
8.0.300.0000.00720.04
8.0.290.0040.00416.75
8.0.280.0030.00318.38
8.0.270.0030.00317.30
8.0.260.0040.00417.35
8.0.250.0050.00317.07
8.0.240.0030.00317.03
8.0.230.0030.00617.07
8.0.220.0050.00217.06
8.0.210.0000.00716.88
8.0.200.0040.00717.05
8.0.190.0000.00816.92
8.0.180.0000.00816.98
8.0.170.0040.00416.87
8.0.160.0000.00816.96
8.0.150.0070.00016.85
8.0.140.0030.00516.92
8.0.130.0030.00313.43
8.0.120.0000.00816.98
8.0.110.0030.00617.03
8.0.100.0040.00416.98
8.0.90.0000.00717.12
8.0.80.0060.00917.09
8.0.70.0040.00417.07
8.0.60.0030.00516.92
8.0.50.0070.00016.92
8.0.30.0120.00917.15
8.0.20.0070.01217.48
8.0.10.0040.00417.06
8.0.00.0110.00616.95
7.4.330.0030.00315.08
7.4.320.0030.00316.77
7.4.300.0070.00016.83
7.4.290.0030.00316.84
7.4.280.0000.00816.91
7.4.270.0030.00316.80
7.4.260.0040.00716.74
7.4.250.0040.00416.75
7.4.240.0020.00616.92
7.4.230.0000.00716.72
7.4.220.0060.01316.64
7.4.210.0100.00316.77
7.4.200.0070.00016.98
7.4.160.0100.00616.83
7.4.150.0130.01017.40
7.4.140.0100.01417.86
7.4.130.0110.01216.88
7.4.120.0120.00816.86
7.4.110.0120.00616.65
7.4.100.0130.01016.57
7.4.90.0070.01016.95
7.4.80.0080.01219.39
7.4.70.0100.01316.74
7.4.60.0140.00716.66
7.4.50.0030.00616.49
7.4.40.0170.00016.32
7.4.30.0150.00816.57
7.4.00.0090.00315.15
7.3.330.0000.00713.32
7.3.320.0000.00513.46
7.3.310.0070.00016.52
7.3.300.0070.00016.52
7.3.290.0080.00716.49
7.3.280.0110.00716.45
7.3.270.0190.00017.40
7.3.260.0150.00716.54
7.3.250.0060.01116.56
7.3.240.0070.01016.37
7.3.230.0190.00316.43
7.3.210.0070.01016.48
7.3.200.0090.00916.48
7.3.190.0130.00316.48
7.3.180.0090.00616.56
7.3.170.0100.00716.62
7.3.160.0070.01116.56
7.2.330.0140.00316.84
7.2.320.0110.01416.82
7.2.310.0110.00716.87
7.2.300.0100.00716.80
7.2.290.0030.01516.74
7.2.00.0090.00619.77
7.1.100.0090.00317.97
7.1.70.0000.00817.40
7.1.60.0090.01219.27
7.1.50.0230.01334.63
7.1.00.0030.07722.56
7.0.200.0040.00416.96
7.0.60.0030.06720.05
7.0.50.0100.07717.91
7.0.40.0000.05320.14
7.0.30.0300.05720.25
7.0.20.0370.07020.27
7.0.10.0100.06720.27
7.0.00.0100.06020.36
5.6.280.0000.07021.09
5.6.210.0100.06720.73
5.6.200.0070.03718.18
5.6.190.0000.05020.61
5.6.180.0200.06720.63
5.6.170.0270.04320.47
5.6.160.0030.06020.50
5.6.150.0070.08718.21
5.6.140.0070.04018.19
5.6.130.0070.08018.28
5.6.120.0000.04321.00
5.6.110.0070.07721.13
5.6.100.0170.07020.96
5.6.90.0070.04721.04
5.6.80.0170.07320.39
5.5.350.0000.08320.39
5.5.340.0170.07017.94
5.5.330.0100.04320.20
5.5.320.0230.08320.25
5.5.310.0230.05320.36
5.5.300.0100.08018.05
5.5.290.0100.04717.98
5.5.280.0030.04720.78
5.5.270.0000.04320.65
5.5.260.0070.05320.88
5.5.250.0130.05720.67
5.5.240.0230.04020.27
5.4.450.0770.05719.63
5.4.440.0870.05319.20
5.4.430.0830.04719.55
5.4.420.0670.06019.38
5.4.410.0800.05019.49
5.4.400.0600.05319.29
5.4.390.0570.05319.06
5.4.380.0600.06019.25
5.4.370.0730.05318.88
5.4.360.0700.05719.07
5.4.350.0770.04718.87
5.4.340.0630.06318.99
5.4.320.0900.06719.31
5.4.310.0900.06018.97
5.4.300.0500.06019.12
5.4.290.0670.04719.29
5.4.280.0630.05019.32
5.4.270.0400.07019.14
5.4.260.0800.04718.84
5.4.250.0700.05718.98
5.4.240.0770.06719.28
5.4.230.0600.05318.87
5.4.220.0700.07019.11
5.4.210.0600.06319.15
5.4.200.0700.05319.28
5.4.190.0630.05019.05
5.4.180.0770.05019.14
5.4.170.0800.04719.11
5.4.160.0700.03719.13
5.4.150.0730.05318.96
5.4.140.0600.04716.39
5.4.130.0600.05016.48
5.4.120.0530.05316.56
5.4.110.0530.05316.68
5.4.100.0500.05316.66
5.4.90.0570.04716.68
5.4.80.0570.05016.48
5.4.70.0000.07016.25
5.4.60.0000.04716.53
5.4.50.0030.04316.58
5.4.40.0230.04016.35
5.4.30.0230.06016.38
5.4.20.0130.04016.57

preferences:
47.75 ms | 401 KiB | 5 Q