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 = mysql_real_escape_string($value); $value = $this->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.0110.01118.56
8.3.50.0120.01021.11
8.3.40.0110.00418.70
8.3.30.0110.00418.85
8.3.20.0030.00520.16
8.3.10.0080.00021.76
8.3.00.0080.00017.80
8.2.180.0140.00418.41
8.2.170.0080.00822.96
8.2.160.0070.01020.27
8.2.150.0000.00824.18
8.2.140.0080.00024.66
8.2.130.0040.00426.16
8.2.120.0050.00517.50
8.2.110.0060.00320.43
8.2.100.0070.00419.82
8.2.90.0040.00418.97
8.2.80.0050.00317.97
8.2.70.0030.00617.50
8.2.60.0090.00017.80
8.2.50.0000.00918.07
8.2.40.0030.00518.22
8.2.30.0070.00018.07
8.2.20.0040.00417.70
8.2.10.0070.00018.08
8.2.00.0000.00717.95
8.1.280.0100.00725.92
8.1.270.0070.01022.15
8.1.260.0050.00326.35
8.1.250.0040.00428.09
8.1.240.0030.00619.21
8.1.230.0110.00017.77
8.1.220.0000.00917.74
8.1.210.0000.00818.77
8.1.200.0040.00417.36
8.1.190.0040.00417.11
8.1.180.0030.00618.10
8.1.170.0000.00818.50
8.1.160.0000.00818.76
8.1.150.0040.00418.84
8.1.140.0040.00417.52
8.1.130.0000.00717.67
8.1.120.0000.00717.38
8.1.110.0050.00217.39
8.1.100.0000.00717.43
8.1.90.0070.00017.34
8.1.80.0070.00017.31
8.1.70.0000.00717.39
8.1.60.0000.00717.63
8.1.50.0040.00417.55
8.1.40.0030.00517.41
8.1.30.0040.00417.63
8.1.20.0080.00017.73
8.1.10.0040.00417.59
8.1.00.0040.00417.49
8.0.300.0050.00318.77
8.0.290.0000.00916.63
8.0.280.0030.00318.40
8.0.270.0050.00317.25
8.0.260.0080.00017.17
8.0.250.0000.00716.86
8.0.240.0000.00617.01
8.0.230.0040.00416.97
8.0.220.0030.00316.92
8.0.210.0040.00416.95
8.0.200.0040.00416.92
8.0.190.0070.00016.88
8.0.180.0070.00016.91
8.0.170.0000.00816.96
8.0.160.0070.00016.88
8.0.150.0000.00816.82
8.0.140.0030.00516.75
8.0.130.0000.00713.38
8.0.120.0030.00616.77
8.0.110.0040.00416.77
8.0.100.0000.00716.78
8.0.90.0050.00216.90
8.0.80.0040.01216.90
8.0.70.0040.00416.97
8.0.60.0000.00716.94
8.0.50.0050.00316.85
8.0.30.0060.01117.09
8.0.20.0100.00817.40
8.0.10.0000.00716.93
8.0.00.0110.00816.71
7.4.330.0020.00215.08
7.4.320.0030.00316.44
7.4.300.0000.00616.52
7.4.290.0040.00416.41
7.4.280.0030.00516.62
7.4.270.0070.00016.61
7.4.260.0030.00616.58
7.4.250.0000.00916.50
7.4.240.0000.00716.55
7.4.230.0000.00716.69
7.4.220.0120.01016.46
7.4.210.0090.00616.46
7.4.200.0030.00316.71
7.4.160.0080.00816.30
7.4.150.0070.01017.40
7.4.140.0090.00917.86
7.4.130.0130.00516.58
7.4.120.0090.00916.42
7.4.110.0070.01016.53
7.4.100.0130.01016.46
7.4.90.0100.00616.56
7.4.80.0110.00619.39
7.4.70.0090.00916.47
7.4.60.0060.01016.48
7.4.50.0000.00816.60
7.4.40.0060.01016.52
7.4.30.0100.00716.70
7.4.10.0100.00714.96
7.4.00.0070.01014.87
7.3.330.0040.00413.39
7.3.320.0000.00513.29
7.3.310.0000.00716.28
7.3.300.0070.00016.37
7.3.290.0040.01216.32
7.3.280.0120.00616.32
7.3.270.0080.01217.40
7.3.260.0030.01416.31
7.3.250.0120.00616.40
7.3.240.0060.01016.27
7.3.230.0060.01616.39
7.3.210.0100.00716.29
7.3.200.0100.00716.48
7.3.190.0040.01116.52
7.3.180.0090.00616.61
7.3.170.0060.01016.66
7.3.160.0080.00816.36
7.3.130.0040.01514.95
7.3.120.0050.01214.64
7.3.110.0050.01214.68
7.3.100.0050.01014.78
7.3.90.0030.00714.63
7.3.80.0090.00614.76
7.3.70.0090.00414.92
7.3.60.0060.00714.65
7.3.50.0020.01014.59
7.3.40.0050.00714.83
7.3.30.0030.01114.67
7.3.20.0030.00816.50
7.3.10.0100.00616.68
7.3.00.0070.01016.50
7.2.330.0100.01016.53
7.2.320.0150.00316.27
7.2.310.0090.00916.61
7.2.300.0060.01016.56
7.2.290.0090.00916.75
7.2.260.0030.01414.71
7.2.250.0070.01214.89
7.2.240.0030.01214.90
7.2.230.0060.00914.91
7.2.220.0090.00614.83
7.2.210.0030.01214.82
7.2.200.0070.01014.76
7.2.190.0050.00714.85
7.2.180.0050.00814.87
7.2.170.0030.01114.97
7.2.160.0100.00314.88
7.2.150.0060.00616.84
7.2.140.0040.00816.62
7.2.130.0060.00816.59
7.2.120.0000.01716.89
7.2.110.0110.01016.58
7.2.100.0040.00816.64
7.2.90.0030.01316.95
7.2.80.0000.01416.79
7.2.70.0090.00916.79
7.2.60.0120.00516.67
7.2.50.0070.01016.69
7.2.40.0030.00716.91
7.2.30.0000.01016.64
7.2.20.0000.01616.90
7.2.10.0030.01316.63
7.2.00.0050.00717.98
7.1.330.0080.00815.72
7.1.320.0030.01115.63
7.1.310.0080.00415.53
7.1.300.0060.00615.64
7.1.290.0070.00715.71
7.1.280.0080.00315.62
7.1.270.0060.00815.75
7.1.260.0030.01015.64
7.1.250.0070.00315.60
7.1.240.0000.00815.74
7.1.230.0000.01515.64
7.1.220.0030.01015.64
7.1.210.0030.00715.60
7.1.200.0070.00415.52
7.1.190.0030.01415.66
7.1.180.0080.00815.78
7.1.170.0100.00315.57
7.1.160.0060.00615.72
7.1.150.0080.00415.82
7.1.140.0000.01515.72
7.1.130.0070.01115.64
7.1.120.0030.01015.55
7.1.110.0040.00415.63
7.1.100.0060.00617.08
7.1.90.0070.00715.67
7.1.80.0060.00315.84
7.1.70.0020.00916.36
7.1.60.0030.01417.51
7.1.50.0190.00725.11
7.1.40.0030.01015.58
7.1.30.0070.00715.76
7.1.20.0070.00715.43
7.1.10.0060.00915.67
7.1.00.0050.03919.06
7.0.330.0000.01515.40
7.0.320.0040.01115.02
7.0.310.0070.00715.15
7.0.300.0030.00715.39
7.0.290.0040.00715.47
7.0.280.0070.01115.17
7.0.270.0000.01015.18
7.0.260.0090.00615.34
7.0.250.0070.00415.30
7.0.240.0030.00915.54
7.0.230.0080.00415.36
7.0.220.0040.01115.43
7.0.210.0040.00815.52
7.0.200.0010.00715.99
7.0.190.0000.01315.36
7.0.180.0140.00015.45
7.0.170.0040.00715.42
7.0.160.0060.00615.46
7.0.150.0040.01115.24
7.0.140.0080.00615.42
7.0.130.0000.01115.49
7.0.120.0000.00815.32
7.0.110.0040.01115.29
7.0.100.0030.00915.32
7.0.90.0060.00915.44
7.0.80.0060.00915.41
7.0.70.0110.00315.39
7.0.60.0050.04017.71
7.0.50.0060.03616.74
7.0.40.0040.02716.65
7.0.30.0060.02816.82
7.0.20.0200.02816.95
7.0.10.0030.02716.79
7.0.00.0080.04616.92
5.6.400.0030.01314.02
5.6.390.0080.00414.18
5.6.380.0060.00614.33
5.6.370.0120.00014.34
5.6.360.0060.00314.28
5.6.350.0110.00414.31
5.6.340.0080.00314.16
5.6.330.0090.00614.20
5.6.320.0000.01214.44
5.6.310.0090.00614.23
5.6.300.0030.01314.31
5.6.290.0120.00414.36
5.6.280.0070.00714.29
5.6.270.0000.01214.21
5.6.260.0070.00714.16
5.6.250.0030.00714.21
5.6.240.0090.00314.16
5.6.230.0060.00314.04
5.6.220.0030.00914.13
5.6.210.0050.04617.32
5.6.200.0070.04116.21
5.6.190.0080.02317.36
5.6.180.0170.02917.37
5.6.170.0070.03117.45
5.6.160.0060.02517.44
5.6.150.0030.04716.06
5.6.140.0030.02316.09
5.6.130.0020.03216.12
5.6.120.0090.02517.55
5.6.110.0110.02617.52
5.6.100.0060.02117.63
5.6.90.0050.04617.79
5.6.80.0050.02717.23
5.6.70.0070.00713.99
5.6.60.0030.00914.09
5.6.50.0080.00814.05
5.6.40.0100.00714.11
5.6.30.0000.01114.18
5.6.20.0130.00314.17
5.6.10.0070.01013.82
5.6.00.0060.00613.95
5.5.380.0090.00614.02
5.5.370.0030.00614.07
5.5.360.0060.00314.06
5.5.350.0080.04217.14
5.5.340.0130.03016.16
5.5.330.0100.02017.32
5.5.320.0180.03817.17
5.5.310.0170.04217.27
5.5.300.0040.04616.09
5.5.290.0080.04316.10
5.5.280.0040.03317.30
5.5.270.0110.04117.39
5.5.260.0070.02817.25
5.5.250.0080.03017.24
5.5.240.0130.03216.89
5.5.230.0060.00313.84
5.5.220.0040.00814.16
5.5.210.0140.00313.91
5.5.200.0030.01013.91
5.5.190.0060.00614.07
5.5.180.0060.00913.98
5.5.170.0040.00414.20
5.5.160.0000.00913.93
5.5.150.0110.00414.02
5.5.140.0070.01014.08
5.5.130.0040.01114.10
5.5.120.0070.00714.18
5.5.110.0090.00314.08
5.5.100.0090.00613.82
5.5.90.0030.01213.95
5.5.80.0120.00613.96
5.5.70.0000.01813.82
5.5.60.0080.00813.93
5.5.50.0040.01114.16
5.5.40.0070.00713.98
5.5.30.0040.01114.07
5.5.20.0030.01413.97
5.5.10.0000.01314.21
5.5.00.0100.00314.00
5.4.450.0520.03315.04
5.4.440.0480.04015.19
5.4.430.0470.04515.32
5.4.420.0460.03715.33
5.4.410.0430.04115.13
5.4.400.0460.03315.02
5.4.390.0500.03814.99
5.4.380.0510.03114.98
5.4.370.0370.04714.91
5.4.360.0430.03815.14
5.4.350.0350.03315.14
5.4.340.0500.02814.81
5.4.330.0060.00311.01
5.4.320.0420.03015.08
5.4.310.0520.03014.73
5.4.300.0400.03214.92
5.4.290.0480.03015.09
5.4.280.0410.04115.07
5.4.270.0370.03615.09
5.4.260.0380.04014.97
5.4.250.0330.04314.92
5.4.240.0380.03914.92
5.4.230.0300.04515.13
5.4.220.0330.03314.93
5.4.210.0400.04314.98
5.4.200.0450.04015.05
5.4.190.0450.04014.90
5.4.180.0430.03514.78
5.4.170.0400.04115.12
5.4.160.0430.03815.12
5.4.150.0450.03814.95
5.4.140.0330.04313.75
5.4.130.0330.04013.71
5.4.120.0410.02713.69
5.4.110.0360.02613.59
5.4.100.0320.03013.81
5.4.90.0390.03413.67
5.4.80.0370.03513.63
5.4.70.0060.03513.73
5.4.60.0080.02913.59
5.4.50.0030.01713.60
5.4.40.0110.02113.69
5.4.30.0220.03213.47
5.4.20.0080.02213.72
5.4.10.0040.00711.03
5.4.00.0000.01110.85

preferences:
62.33 ms | 401 KiB | 5 Q