3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Stripper{ var $regex; var $stripped; var $decoded; var $current_encoding; var $result; function __construct(){ mb_internal_encoding('UTF-8'); //mb_regex_encoding("UTF-8"); setlocale(LC_ALL, 'de_DE@euro', 'de_DE', 'deu_deu'); } function convert($string, $targetEncoding = 'UTF-8'){ $current_encoding = mb_detect_encoding($string); if($current_encoding != $targetEncoding){ $string = mb_convert_encoding($string, $targetEncoding, mb_detect_encoding($string)); } $result = $string; return $result; } //this function returns characters, whitespace, underscores and linebreaks plus @ , and - function strip($string){ //$this->convert($string); $result = mb_ereg_replace("[^\w\s@,\-\.]*", "", $string); return $result; } //this function returns $digits of number and discards everything else function onlyNumbers($string, $digits=0){ //$this->convert($string); $result = mb_ereg_replace("[^\d]*", "", $string); if($digits > 0){ $result = substr($result, 0, $digits); } return $result; } function decode($string, $type="all"){ //$this->convert($string); if($type == "all" || $type == "strip"){ $string = stripslashes($string); } if ($type == "all" || $type == "decode"){ $string = urldecode($string); } $result = $string; return $result; } } //mb_detect_order ( mb_internal_encoding('UTF-8'); mb_http_output('UTF-8'); mb_http_input('UTF-8'); mb_language('uni'); mb_regex_encoding('UTF-8'); ob_start('mb_output_handler'); //var_dump(mb_regex_encoding()); //var_dump( mb_get_info()); $value = "Häslïchëräëÿüïöáéüúíóßñµç.,_-;()''\"\" "; //$value = $stripper->decode($value); //$value = $stripper->convert($value); echo "before strip :" . mb_detect_encoding($value) . " for $value<br />"; //$_POST[$key] = $purifier->purify($_POST[$key]); //$value = str_replace("ß","ss",$value); $stripper = new Stripper(); $value = $stripper->strip($value); echo "after strip :". mb_detect_encoding($value) . " for $value<br />"; //phpinfo();

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.00318.18
8.3.50.0120.00922.05
8.3.40.0140.00018.79
8.3.30.0120.00319.08
8.3.20.0070.00020.18
8.3.10.0040.00421.85
8.3.00.0080.00017.93
8.2.180.0160.00616.50
8.2.170.0100.01022.96
8.2.160.0070.00722.08
8.2.150.0040.00424.18
8.2.140.0040.00424.66
8.2.130.0040.00426.16
8.2.120.0040.00420.96
8.2.110.0050.00522.30
8.2.100.0040.00717.78
8.2.90.0030.00619.19
8.2.80.0050.00317.97
8.2.70.0040.00417.50
8.2.60.0030.00617.80
8.2.50.0000.00818.07
8.2.40.0030.00619.82
8.2.30.0040.00418.05
8.2.20.0060.00617.67
8.2.10.0070.00018.12
8.2.00.0040.00417.73
8.1.280.0070.01025.92
8.1.270.0030.00623.97
8.1.260.0000.00826.35
8.1.250.0000.00728.09
8.1.240.0060.00323.92
8.1.230.0080.00319.22
8.1.220.0040.00417.74
8.1.210.0040.00418.77
8.1.200.0070.00717.23
8.1.190.0000.00817.10
8.1.180.0000.00918.10
8.1.170.0000.00818.59
8.1.160.0040.00422.00
8.1.150.0030.00518.79
8.1.140.0020.00517.40
8.1.130.0030.00317.74
8.1.120.0040.00417.27
8.1.110.0000.00917.40
8.1.100.0080.00017.42
8.1.90.0030.00617.26
8.1.80.0000.00817.41
8.1.70.0070.00017.33
8.1.60.0040.00417.40
8.1.50.0000.00817.50
8.1.40.0050.00517.50
8.1.30.0000.00817.54
8.1.20.0000.00817.64
8.1.10.0050.00217.50
8.1.00.0050.00317.53
8.0.300.0000.00718.77
8.0.290.0040.00416.88
8.0.280.0030.00318.41
8.0.270.0070.00017.34
8.0.260.0000.00717.12
8.0.250.0000.00717.01
8.0.240.0070.00016.94
8.0.230.0030.00317.02
8.0.220.0000.00716.94
8.0.210.0000.00716.80
8.0.200.0030.00516.88
8.0.190.0030.00316.98
8.0.180.0030.00417.02
8.0.170.0020.00516.86
8.0.160.0080.00016.81
8.0.150.0040.00416.79
8.0.140.0030.00516.88
8.0.130.0030.00313.42
8.0.120.0040.00416.92
8.0.110.0000.00716.87
8.0.100.0050.00316.77
8.0.90.0030.00616.87
8.0.80.0080.00716.98
8.0.70.0000.00717.00
8.0.60.0000.00816.91
8.0.50.0040.00416.78
8.0.30.0110.01017.05
8.0.20.0180.00517.40
8.0.10.0050.00216.84
8.0.00.0100.00816.73
7.4.330.0030.00315.71
7.4.320.0030.00317.18
7.4.300.0070.00017.17
7.4.290.0070.00317.16
7.4.280.0000.00817.14
7.4.270.0040.00417.04
7.4.260.0070.00017.16
7.4.250.0000.00717.10
7.4.240.0030.00517.18
7.4.230.0040.00417.26
7.4.220.0140.00517.17
7.4.210.0110.00317.08
7.4.200.0000.00816.96
7.4.160.0090.00617.15
7.4.150.0130.00717.40
7.4.140.0160.00517.86
7.4.130.0060.01117.34
7.4.120.0120.00517.02
7.4.110.0100.01017.11
7.4.100.0100.01017.10
7.4.90.0090.00916.76
7.4.80.0080.01619.39
7.4.70.0110.00617.11
7.4.60.0030.01817.05
7.4.50.0000.00717.15
7.4.40.0140.00416.88
7.4.30.0140.00316.91
7.4.00.0030.01515.32
7.3.330.0060.00013.71
7.3.320.0060.00013.86
7.3.310.0070.00016.85
7.3.300.0000.00716.73
7.3.290.0150.00016.86
7.3.280.0110.00616.86
7.3.270.0090.00917.40
7.3.260.0190.00316.81
7.3.250.0110.00816.92
7.3.240.0180.00016.70
7.3.230.0060.01117.10
7.3.210.0120.01217.18
7.3.200.0150.00319.39
7.3.190.0220.00417.13
7.3.180.0060.01317.03
7.3.170.0090.00916.85
7.3.160.0080.00816.98
7.3.120.0070.01014.92
7.3.00.0040.00916.59
7.2.330.0000.01817.33
7.2.320.0070.01016.88
7.2.310.0090.00917.27
7.2.300.0060.01017.01
7.2.290.0070.01717.18
7.2.130.0050.01016.98
7.2.120.0110.00316.93
7.2.110.0080.00916.99
7.2.100.0090.00916.91
7.2.90.0070.00916.88
7.2.80.0070.00817.02
7.2.70.0080.00916.97
7.2.60.0080.00816.95
7.2.50.0130.00817.05
7.2.40.0070.01016.96
7.2.30.0050.01017.16
7.2.20.0120.00616.93
7.2.10.0080.00817.02
7.2.00.0070.00717.96
7.1.250.0040.00915.93
7.1.240.0060.00915.86
7.1.230.0090.00915.76
7.1.220.0110.00315.95
7.1.210.0120.00215.82
7.1.200.0090.00515.94
7.1.190.0080.00615.84
7.1.180.0100.00715.83
7.1.170.0070.00915.93
7.1.160.0110.00516.04
7.1.150.0040.01115.77
7.1.140.0070.00715.99
7.1.130.0050.01115.83
7.1.120.0050.01115.84
7.1.110.0090.00715.87
7.1.100.0070.01016.69
7.1.90.0120.00415.71
7.1.80.0080.00515.98
7.1.70.0060.00616.42
7.1.60.0080.01117.09
7.1.50.0040.01016.42
7.1.40.0120.00515.95
7.1.30.0100.00515.84
7.1.20.0120.00516.01
7.1.10.0080.00816.01
7.1.00.0070.02918.08
7.0.330.0030.01115.42
7.0.320.0080.00515.41
7.0.310.0100.00615.34
7.0.300.0090.00615.49
7.0.290.0080.00515.45
7.0.280.0080.00815.46
7.0.270.0080.00515.40
7.0.260.0070.00515.40
7.0.250.0080.00515.41
7.0.240.0100.00415.41
7.0.230.0080.00615.63
7.0.220.0040.00715.62
7.0.210.0110.00515.55
7.0.200.0090.00415.92
7.0.190.0080.00915.43
7.0.180.0110.00415.32
7.0.170.0100.00515.46
7.0.160.0130.00515.45
7.0.150.0110.00515.46
7.0.140.0060.02717.61
7.0.130.0060.00915.35
7.0.120.0070.00815.57
7.0.110.0150.00215.57
7.0.100.0100.00715.37
7.0.90.0100.00515.51
7.0.80.0110.00515.49
7.0.70.0040.01015.46
7.0.60.0070.03216.87
7.0.50.0090.03516.44
7.0.40.0100.01415.83
7.0.30.0120.03415.82
7.0.20.0110.03215.71
7.0.10.0050.01915.72
7.0.00.0070.02615.80
5.6.380.0080.00714.43
5.6.370.0080.00714.25
5.6.360.0080.00714.32
5.6.350.0100.00314.29
5.6.340.0070.00514.22
5.6.330.0070.01114.09
5.6.320.0090.00514.63
5.6.310.0020.01114.57
5.6.300.0060.00714.29
5.6.290.0080.00614.41
5.6.280.0080.02716.51
5.6.270.0040.01014.54
5.6.260.0120.00314.38
5.6.250.0080.00614.38
5.6.240.0050.00614.49
5.6.230.0090.00414.28
5.6.220.0070.00514.35
5.6.210.0110.02316.43
5.6.200.0080.02315.57
5.6.190.0070.02716.62
5.6.180.0090.03216.36
5.6.170.0080.02416.31
5.6.160.0110.02416.55
5.6.150.0080.03215.63
5.6.140.0070.02715.69
5.6.130.0080.03315.67
5.6.120.0070.03116.58
5.6.110.0060.03416.61
5.6.100.0080.02216.67
5.6.90.0080.03216.49
5.6.80.0090.02616.19
5.6.70.1300.01816.34
5.6.60.0030.01014.31
5.6.50.0110.00614.45
5.6.40.0050.00814.16
5.6.30.0080.00714.35
5.6.20.0090.00614.23
5.6.10.0050.01214.23
5.6.00.0110.00614.24
5.5.380.0030.00611.09
5.5.370.0030.00611.36
5.5.360.0060.00610.99
5.5.350.0040.03414.21
5.5.340.0040.03313.44
5.5.330.0110.02614.21
5.5.320.1140.02414.36
5.5.310.0120.03014.35
5.5.300.0060.01413.48
5.5.290.0050.02913.63
5.5.280.0050.03214.54
5.5.270.0050.03114.40
5.5.260.0030.01714.50
5.5.250.0110.02814.45
5.5.240.0150.02514.26
5.5.230.0040.00711.21
5.5.220.0050.00411.12
5.5.210.0050.00611.28
5.5.200.0060.00510.93
5.5.190.0030.00911.34
5.5.180.0060.00211.11
5.5.170.0050.00611.17
5.5.160.0040.00811.02
5.5.150.0030.00711.31
5.5.140.0060.00511.16
5.5.130.0020.00711.24
5.5.120.0050.00511.11
5.5.110.0050.00411.23
5.5.100.0030.00911.46
5.5.90.0040.00911.16
5.5.80.0090.00111.13
5.5.70.0090.00411.15
5.5.60.0030.00611.15
5.5.50.0070.00611.36
5.5.40.0050.00511.17
5.5.30.0020.00911.25
5.5.20.0040.00811.04
5.5.10.0040.00511.20
5.5.00.0000.01011.12
5.4.450.0130.01714.06
5.4.440.0080.02013.95
5.4.430.0180.01513.85
5.4.420.0230.01813.79
5.4.410.0170.01313.90
5.4.400.0100.02013.76
5.4.390.0140.01913.68
5.4.380.0270.03113.69
5.4.370.0310.02513.59
5.4.360.0380.01813.63
5.4.350.0360.02213.54
5.4.340.0210.02313.63
5.4.330.0050.00811.13
5.4.320.0050.01811.58
5.4.310.0040.01811.49
5.4.300.0050.01711.46
5.4.290.0080.01311.55
5.4.280.0060.01711.68
5.4.270.0040.01811.52
5.4.260.0020.01911.47
5.4.250.0060.01711.56
5.4.240.0060.01511.59
5.4.230.0080.01511.48
5.4.220.0040.01411.57
5.4.210.0070.01411.46
5.4.200.0060.01611.56
5.4.190.0070.01611.54
5.4.180.0060.01711.51
5.4.170.0070.01711.60
5.4.160.0080.01411.57
5.4.150.0040.01811.51
5.4.140.0040.01811.32
5.4.130.0070.01611.50
5.4.120.0040.01611.42
5.4.110.0070.01511.47
5.4.100.0050.01811.35
5.4.90.0040.01711.29
5.4.80.0060.01511.47
5.4.70.0020.01811.44
5.4.60.0040.01611.42
5.4.50.0050.01611.30
5.4.40.0040.01511.48
5.4.30.0050.01411.30
5.4.20.0020.01711.34
5.4.10.0030.02011.40
5.4.00.0060.01311.24
5.3.290.0050.01811.40
5.3.280.0060.01711.41
5.3.270.0040.01811.47
5.3.260.0070.01511.44
5.3.250.0050.02011.44
5.3.240.0070.01811.43
5.3.230.0050.01711.38
5.3.220.0060.01411.39
5.3.210.0060.01611.42
5.3.200.0070.01511.42
5.3.190.0050.01611.38
5.3.180.0070.01611.43
5.3.170.0040.01711.41
5.3.160.0040.01711.35
5.3.150.0070.01711.35
5.3.140.0050.01811.33
5.3.130.0070.01611.41
5.3.120.0060.01711.41
5.3.110.0090.01611.32
5.3.100.0070.01311.23
5.3.90.0040.01611.24
5.3.80.0050.01611.10
5.3.70.0060.01511.21
5.3.60.0040.01711.25
5.3.50.0040.01711.19
5.3.40.0040.01611.21
5.3.30.0070.01411.21
5.3.20.0020.01711.12
5.3.10.0030.01710.95
5.3.00.0050.01611.04
5.2.170.0030.01510.01
5.2.160.0030.0149.99
5.2.150.0020.01510.00
5.2.140.0020.0139.93
5.2.130.0050.0129.99
5.2.120.0060.01210.01
5.2.110.0050.0139.96
5.2.100.0050.0109.95
5.2.90.0030.0159.90
5.2.80.0040.0139.95
5.2.70.0070.0129.97
5.2.60.0030.0149.87
5.2.50.0030.0159.95
5.2.40.0040.0139.88
5.2.30.0040.0169.93
5.2.20.0010.0149.86
5.2.10.0020.0149.84
5.2.00.0030.0139.81
5.1.60.0030.0129.25
5.1.50.0060.0099.34
5.1.40.0040.0119.35
5.1.30.0020.0129.52
5.1.20.0040.0119.47
5.1.10.0030.0129.38
5.1.00.0040.0109.16
5.0.50.0050.0108.67
5.0.40.0040.0098.62
5.0.30.0030.0148.55
5.0.20.0050.0078.54
5.0.10.0030.0098.54
5.0.00.0060.0118.53
4.4.90.0040.0078.02
4.4.80.0000.0108.01
4.4.70.0020.0088.01
4.4.60.0020.0088.01
4.4.50.0030.0088.02
4.4.40.0010.0127.99
4.4.30.0040.0078.01
4.4.20.0040.0068.04
4.4.10.0020.0088.04
4.4.00.0020.0108.01
4.3.110.0030.0077.98
4.3.100.0020.0097.98
4.3.90.0010.0087.97
4.3.80.0010.0127.96
4.3.70.0030.0077.97
4.3.60.0010.0107.97
4.3.50.0010.0087.97
4.3.40.0020.0117.94
4.3.30.0020.0077.54
4.3.20.0000.0087.53
4.3.10.0020.0067.51
4.3.00.0020.01111.52

preferences:
48.37 ms | 401 KiB | 5 Q