3v4l.org

run code in 300+ PHP versions simultaneously
<?php headers_sent()?'': header('Content-Type:text/html; charset=UTF-8');?> <!DOCTYPE html><!-- (c) 2006 - 2013 Dealerdirect B.V. --> <html lang="NL"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> </head> <html> <? 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']); } private function to_utf8( $string ) { // From http://w3.org/International/questions/qa-forms-utf-8.html if ( preg_match('%^(?: [\x09\x0A\x0D\x20-\x7E] # ASCII | [\xC2-\xDF][\x80-\xBF] # non-overlong 2-byte | \xE0[\xA0-\xBF][\x80-\xBF] # excluding overlongs | [\xE1-\xEC\xEE\xEF][\x80-\xBF]{2} # straight 3-byte | \xED[\x80-\x9F][\x80-\xBF] # excluding surrogates | \xF0[\x90-\xBF][\x80-\xBF]{2} # planes 1-3 | [\xF1-\xF3][\x80-\xBF]{3} # planes 4-15 | \xF4[\x80-\x8F][\x80-\xBF]{2} # plane 16 )*$%xs', $string) ) { return $string; } else { return iconv( 'CP1252', 'UTF-8', $string); } } 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("[^[:word:][:alnum:][:blank:][:space:]@,\-\.]*", "", $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.0070.00718.18
8.3.50.0070.00921.92
8.3.40.0090.00618.57
8.3.30.0080.00618.71
8.3.20.0000.00720.34
8.3.10.0040.00421.77
8.3.00.0040.00417.93
8.2.180.0090.01216.38
8.2.170.0120.00322.96
8.2.160.0030.01020.39
8.2.150.0080.00024.18
8.2.140.0040.00424.66
8.2.130.0080.00326.16
8.2.120.0080.00021.08
8.2.110.0060.00320.43
8.2.100.0040.00819.76
8.2.90.0040.00419.05
8.2.80.0050.00317.97
8.2.70.0090.00017.50
8.2.60.0000.00717.80
8.2.50.0080.00018.07
8.2.40.0030.00518.03
8.2.30.0030.00518.06
8.2.20.0070.00317.63
8.2.10.0030.00618.03
8.2.00.0070.00017.49
8.1.280.0090.00925.92
8.1.270.0080.00023.91
8.1.260.0070.00026.35
8.1.250.0040.00428.09
8.1.240.0000.01818.96
8.1.230.0110.00019.17
8.1.220.0000.00817.74
8.1.210.0050.00318.77
8.1.200.0040.00417.23
8.1.190.0000.00817.10
8.1.180.0050.00318.10
8.1.170.0040.00418.59
8.1.160.0070.00021.84
8.1.150.0040.00418.80
8.1.140.0040.00417.34
8.1.130.0040.00417.79
8.1.120.0050.00317.25
8.1.110.0050.00317.27
8.1.100.0000.00817.25
8.1.90.0030.00817.33
8.1.80.0040.00417.41
8.1.70.0030.00317.34
8.1.60.0050.00317.39
8.1.50.0050.00317.44
8.1.40.0040.00717.40
8.1.30.0040.00417.52
8.1.20.0000.00817.50
8.1.10.0040.00417.51
8.1.00.0000.00817.32
8.0.300.0070.00018.77
8.0.290.0040.00416.63
8.0.280.0040.00418.34
8.0.270.0000.00717.32
8.0.260.0030.00617.20
8.0.250.0050.00216.73
8.0.240.0070.00016.69
8.0.230.0040.00416.85
8.0.220.0000.00716.78
8.0.210.0040.00416.66
8.0.200.0000.00816.83
8.0.190.0040.00416.78
8.0.180.0000.00716.75
8.0.170.0080.00016.77
8.0.160.0040.00416.77
8.0.150.0050.00316.63
8.0.140.0040.00416.65
8.0.130.0030.00313.34
8.0.120.0050.00316.74
8.0.110.0040.00416.73
8.0.100.0000.00716.77
8.0.90.0070.00016.64
8.0.80.0090.00616.72
8.0.70.0070.00016.73
8.0.60.0000.00716.68
8.0.50.0000.00716.73
8.0.30.0080.01317.08
8.0.20.0130.00617.40
8.0.10.0000.00716.79
8.0.00.0100.00816.56
7.4.330.0030.00315.57
7.4.320.0000.00716.31
7.4.300.0000.00616.38
7.4.290.0080.00416.51
7.4.280.0090.00016.23
7.4.270.0020.00516.39
7.4.260.0070.00016.29
7.4.250.0030.00316.36
7.4.240.0040.00316.39
7.4.230.0070.00016.23
7.4.220.0100.00716.42
7.4.210.0000.01416.46
7.4.200.0050.00216.23
7.4.160.0150.00016.42
7.4.150.0090.00917.40
7.4.140.0130.00617.86
7.4.130.0090.00816.32
7.4.120.0110.00616.29
7.4.110.0040.01416.15
7.4.100.0070.01616.32
7.4.90.0130.00316.32
7.4.80.0070.01819.39
7.4.70.0090.01216.32
7.4.60.0110.00716.24
7.4.50.0060.00816.25
7.4.40.0130.00516.35
7.4.30.0160.00416.30
7.4.20.0080.01216.40
7.4.10.0110.01116.33
7.4.00.0050.00915.68
7.3.330.0030.00313.77
7.3.320.0050.00013.85
7.3.310.0030.00316.22
7.3.300.0030.00316.05
7.3.290.0140.00516.13
7.3.280.0040.01316.15
7.3.270.0100.00717.40
7.3.260.0120.00616.48
7.3.250.0090.01216.18
7.3.240.0030.01416.42
7.3.230.0180.00616.39
7.3.210.0100.01316.67
7.3.200.0160.00316.54
7.3.190.0100.00916.39
7.3.180.0080.01016.28
7.3.170.0100.00716.40
7.3.160.0090.00716.19
7.3.150.0090.00916.29
7.3.140.0080.01016.21
7.3.130.0040.01516.13
7.3.120.0040.01515.42
7.3.110.0180.00316.29
7.3.100.0110.01415.92
7.3.90.0080.01616.09
7.3.80.0240.00916.29
7.3.70.0190.00416.15
7.3.60.0260.00416.19
7.3.50.0070.01716.05
7.3.40.0170.01016.38
7.3.30.0150.01116.28
7.3.20.0150.01016.26
7.3.10.0160.01016.37
7.3.00.0140.01116.18
7.2.330.0030.01416.61
7.2.320.0060.00916.21
7.2.310.0180.00416.42
7.2.300.0090.00816.44
7.2.290.0130.00716.30
7.2.280.0090.00916.29
7.2.270.0100.01016.64
7.2.260.0050.01416.32
7.2.250.0160.00816.21
7.2.240.0090.01216.32
7.2.230.0140.01216.52
7.2.220.0310.00916.58
7.2.210.0140.01416.24
7.2.200.0150.01216.27
7.2.190.0260.00416.34
7.2.180.0150.01116.30
7.2.170.0070.01816.46
7.2.160.0110.01316.21
7.2.150.0090.01616.28
7.2.140.0140.01016.40
7.2.130.0050.02116.62
7.2.120.0140.01116.65
7.2.110.0140.00816.40
7.2.100.0070.01716.34
7.2.90.1780.01016.59
7.2.80.0080.01516.49
7.2.70.0160.00916.53
7.2.60.0150.00616.67
7.2.50.0130.01416.49
7.2.40.0130.00916.22
7.2.30.0180.00816.56
7.2.20.0220.00316.37
7.2.10.0430.01716.31
7.2.00.1630.01518.05
7.1.330.0460.00515.59
7.1.320.0290.01615.54
7.1.310.0230.01115.51
7.1.300.0240.01715.43
7.1.290.0210.01715.48
7.1.280.0250.01415.54
7.1.270.0320.00715.37
7.1.260.0270.01015.24
7.1.250.0150.02215.36
7.1.240.0230.01615.53
7.1.230.0270.00815.32
7.1.220.1020.01315.39
7.1.210.0210.01315.36
7.1.200.0190.01515.28
7.1.190.0290.00515.22
7.1.180.0170.01615.21
7.1.170.0280.00715.36
7.1.160.0290.01015.50
7.1.150.0320.00415.46
7.1.140.0250.01915.29
7.1.130.0220.01515.45
7.1.120.0280.00715.55
7.1.110.0230.01415.29
7.1.100.0120.00916.99
7.1.90.0190.01415.36
7.1.80.0280.00715.36
7.1.70.0120.01016.36
7.1.60.0180.01017.36
7.1.50.0150.01316.19
7.1.40.0150.01815.50
7.1.30.0180.01615.44
7.1.20.3130.00615.41
7.1.10.0160.01615.30
7.1.00.0100.04518.86
7.0.330.0240.00715.07
7.0.320.0260.00315.17
7.0.310.0360.00415.10
7.0.300.0240.01115.10
7.0.290.0310.00415.06
7.0.280.0180.01914.96
7.0.270.0290.00415.04
7.0.260.0230.01115.16
7.0.250.0210.01215.24
7.0.240.0180.01215.15
7.0.230.0200.01015.02
7.0.220.0170.01714.98
7.0.210.0170.01114.94
7.0.200.0130.00715.99
7.0.190.0230.00615.14
7.0.180.0200.01315.09
7.0.170.0220.00914.96
7.0.160.0230.01215.14
7.0.150.0150.01415.20
7.0.140.0080.04718.76
7.0.130.0230.00715.09
7.0.120.0200.01615.21
7.0.110.0220.01115.30
7.0.100.0300.00815.12
7.0.90.0260.00515.28
7.0.80.2070.01315.05
7.0.70.0230.01315.28
7.0.60.0190.04617.59
7.0.50.0200.04216.47
7.0.40.0090.03917.62
7.0.30.0270.03817.71
7.0.20.0280.04517.73
7.0.10.0100.02817.63
7.0.00.0140.05017.66
5.6.400.0250.01515.79
5.6.390.0220.01415.71
5.6.380.0210.01216.03
5.6.370.0330.00516.00
5.6.360.0240.01215.72
5.6.350.0240.01415.88
5.6.340.0260.01115.89
5.6.330.0210.01516.03
5.6.320.0230.01215.94
5.6.310.0360.00315.95
5.6.300.0230.00915.92
5.6.290.0110.02315.66
5.6.280.0100.04518.27
5.6.270.0250.01315.51
5.6.260.0230.02316.06
5.6.250.0230.01515.63
5.6.240.0330.00415.72
5.6.230.0120.02015.73
5.6.220.0190.01315.59
5.6.210.0180.04618.29
5.6.200.0150.03017.03
5.6.190.0140.05018.25
5.6.180.2270.02518.30
5.6.170.0260.03218.11
5.6.160.0130.02818.17
5.6.150.0120.03716.98
5.6.140.0110.02817.02
5.6.130.0130.03117.04
5.6.120.0150.03218.41
5.6.110.0160.04918.47
5.6.100.0150.04518.41
5.6.90.0170.04618.42
5.6.80.0160.04117.95
5.6.70.2360.02318.15
5.6.60.0170.02015.62
5.6.50.0170.01715.80
5.6.40.0150.01515.50
5.6.30.0160.01615.79
5.6.20.0220.01215.69
5.6.10.0300.00315.77
5.6.00.0240.01415.67
5.5.380.0160.01615.83
5.5.370.0170.01715.63
5.5.360.0210.01415.70
5.5.350.0200.04318.09
5.5.340.0140.04616.85
5.5.330.0120.05017.95
5.5.320.1920.02517.89
5.5.310.0260.03017.94
5.5.300.0090.02916.89
5.5.290.0160.04516.89
5.5.280.0110.04918.24
5.5.270.0180.03818.29
5.5.260.0160.04518.34
5.5.250.0180.04118.04
5.5.240.0260.02818.07
5.5.230.0240.00815.57
5.5.220.0130.01715.48
5.5.210.0210.01015.73
5.5.200.0250.01215.73
5.5.190.0230.01315.83
5.5.180.0230.01415.69
5.5.170.0180.01815.71
5.5.160.0150.01515.57
5.5.150.0230.01315.53
5.5.140.0180.01515.64
5.5.130.0230.01415.43
5.5.120.0180.01515.80
5.5.110.0180.01115.59
5.5.100.0210.01215.50
5.5.90.0200.01615.56
5.5.80.0270.00615.52
5.5.70.0210.01215.66
5.5.60.0140.01715.59
5.5.50.0280.00715.44
5.5.40.0120.01515.41
5.5.30.0220.01315.91
5.5.20.0160.01315.60
5.5.10.0200.01615.85
5.5.00.0230.01215.71
5.4.450.0310.02916.13
5.4.440.0240.02616.25
5.4.430.0220.02016.15
5.4.420.0420.02816.23
5.4.410.0380.02316.13
5.4.400.0290.02016.08
5.4.390.0380.02416.16
5.4.380.0200.02815.79
5.4.370.0160.03116.02
5.4.360.0170.02915.92
5.4.350.0140.03415.90
5.4.340.0230.02215.88
5.4.330.0230.00313.14
5.4.320.0150.02112.78
5.4.310.0140.02312.84
5.4.300.0150.02012.78
5.4.290.0090.02512.85
5.4.280.0140.02412.77
5.4.270.0110.02212.65
5.4.260.0100.02512.71
5.4.250.0090.02412.71
5.4.240.0110.02512.75
5.4.230.0120.02412.64
5.4.220.0100.02312.68
5.4.210.0130.02112.67
5.4.200.0090.02612.70
5.4.190.0130.02312.70
5.4.180.0150.02112.66
5.4.170.0120.02112.65
5.4.160.0110.02312.67
5.4.150.0110.02612.68
5.4.140.0160.01912.72
5.4.130.0120.02112.53
5.4.120.0130.02012.57
5.4.110.0110.02412.49
5.4.100.0130.02312.53
5.4.90.0140.02312.55
5.4.80.0100.02312.63
5.4.70.0150.01912.60
5.4.60.0110.02212.49
5.4.50.0100.02512.48
5.4.40.0100.02112.58
5.4.30.0090.03012.46
5.4.20.0080.02512.48
5.4.10.0130.02312.56
5.4.00.0080.02512.30
5.3.290.0140.03212.98
5.3.280.0160.01912.75
5.3.270.0140.02512.82
5.3.260.0130.02312.81
5.3.250.0150.02412.88
5.3.240.0140.02012.75
5.3.230.0110.02512.87
5.3.220.0100.02312.71
5.3.210.0150.02212.61
5.3.200.0140.02112.73
5.3.190.0130.02512.69
5.3.180.0120.02312.90
5.3.170.0100.02412.85
5.3.160.0080.02512.76
5.3.150.0150.02512.85
5.3.140.0110.02312.83
5.3.130.0160.02012.77
5.3.120.0090.02612.75
5.3.110.0110.02412.75
5.3.100.0110.02212.54
5.3.90.0100.02512.46
5.3.80.0080.02612.40
5.3.70.0100.02212.43
5.3.60.0130.02012.43
5.3.50.0110.02212.38
5.3.40.0100.02512.40
5.3.30.0090.02812.42
5.3.20.0090.02312.28
5.3.10.0090.02512.12
5.3.00.0070.02812.16
5.2.170.0110.01810.58
5.2.160.0080.01810.58
5.2.150.0090.02110.61
5.2.140.0050.02510.60
5.2.130.0130.01510.52
5.2.120.0060.02610.54
5.2.110.0060.02110.53
5.2.100.0080.01910.53
5.2.90.0100.02110.53
5.2.80.0100.01910.52
5.2.70.0080.02410.52
5.2.60.0100.01810.50
5.2.50.0080.02310.48
5.2.40.0020.02310.47
5.2.30.0090.02010.46
5.2.20.0130.01810.45
5.2.10.0090.02010.41
5.2.00.0050.02210.34
5.1.60.0040.0229.99
5.1.50.0100.0159.98
5.1.40.0040.0189.98
5.1.30.0080.01610.15
5.1.20.0100.02010.16
5.1.10.0050.02210.02
5.1.00.0120.01610.02
5.0.50.0060.0189.26
5.0.40.0020.0179.19
5.0.30.0060.0209.10
5.0.20.0050.0179.08
5.0.10.0040.0179.07
5.0.00.0060.0239.07
4.4.90.0020.0148.34
4.4.80.0050.0108.33
4.4.70.0030.0128.33
4.4.60.0040.0098.33
4.4.50.0050.0098.34
4.4.40.0050.0158.31
4.4.30.0060.0098.33
4.4.20.0050.0108.37
4.4.10.0050.0108.38
4.4.00.0060.0148.33
4.3.110.0050.0088.28
4.3.100.0060.0078.28
4.3.90.0070.0078.27
4.3.80.0050.0148.24
4.3.70.0040.0118.27
4.3.60.0030.0128.26
4.3.50.0040.0108.26
4.3.40.0020.0168.22
4.3.30.0050.0097.60
4.3.20.0040.0107.58
4.3.10.0010.0127.56
4.3.00.0070.00913.59

preferences:
40.14 ms | 400 KiB | 5 Q