3v4l.org

run code in 300+ PHP versions simultaneously
<?php // taken from walf, http://www.php.net/manual/en/function.hex2bin.php // this function comes with PHP >= 5.4.0 if (!function_exists('hex2bin')) { function hex2bin($data) { static $old; if ($old === null) { $old = version_compare(PHP_VERSION, '5.2', '<'); } $isobj = false; if (is_scalar($data) || (($isobj = is_object($data)) && method_exists($data, '__toString'))) { if ($isobj && $old) { ob_start(); echo $data; $data = ob_get_clean(); } else { $data = (string) $data; } } else { trigger_error(__FUNCTION__.'() expects parameter 1 to be string, ' . gettype($data) . ' given', E_USER_WARNING); return; //null in this case } $len = strlen($data); if ($len % 2) { trigger_error(__FUNCTION__.'(): Hexadecimal input string must have an even length', E_USER_WARNING); return false; } if (strspn($data, '0123456789abcdefABCDEF') != $len) { trigger_error(__FUNCTION__.'(): Input string must be hexadecimal string', E_USER_WARNING); return false; } return pack('H*', $data); } } function heutf8($str, $ent_constant = ENT_COMPAT) { return htmlentities($str, $ent_constant, 'UTF-8'); } $str = hex2bin('c0206c61206d6169736f6e'); print(heutf8($str)); ?>

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.0150.00016.50
8.3.50.0080.00721.02
8.3.40.0070.00718.67
8.3.30.0120.00319.00
8.3.20.0000.00820.21
8.3.10.0080.00023.54
8.3.00.0040.00420.93
8.2.180.0130.00318.53
8.2.170.0000.01522.96
8.2.160.0030.01020.39
8.2.150.0000.00824.18
8.2.140.0070.00024.66
8.2.130.0040.00426.16
8.2.120.0040.00419.36
8.2.110.0060.00621.96
8.2.100.0110.00017.72
8.2.90.0000.00819.13
8.2.80.0080.00017.97
8.2.70.0030.00517.36
8.2.60.0050.00317.93
8.2.50.0060.00318.07
8.2.40.0050.00320.01
8.2.30.0040.00418.28
8.2.20.0020.00517.60
8.2.10.0000.00817.99
8.2.00.0000.00819.45
8.1.280.0190.00025.92
8.1.270.0040.00422.19
8.1.260.0050.00226.35
8.1.250.0040.00428.09
8.1.240.0060.00323.98
8.1.230.0060.00617.42
8.1.220.0040.00417.74
8.1.210.0030.00518.77
8.1.200.0060.00317.11
8.1.190.0040.00417.22
8.1.180.0080.00018.10
8.1.170.0080.00018.61
8.1.160.0080.00022.07
8.1.150.0040.00418.61
8.1.140.0030.00717.52
8.1.130.0040.00417.86
8.1.120.0070.00317.51
8.1.110.0000.00817.40
8.1.100.0050.00217.54
8.1.90.0080.00017.50
8.1.80.0040.00417.53
8.1.70.0070.00017.45
8.1.60.0040.00417.63
8.1.50.0050.00317.44
8.1.40.0000.00817.45
8.1.30.0090.00017.55
8.1.20.0040.00417.70
8.1.10.0000.00817.48
8.1.00.0070.00017.48
8.0.300.0030.00518.77
8.0.290.0060.00316.75
8.0.280.0000.00718.48
8.0.270.0030.00517.30
8.0.260.0000.00717.21
8.0.250.0000.00616.91
8.0.240.0030.00317.02
8.0.230.0000.00716.99
8.0.220.0030.00316.97
8.0.210.0040.00416.91
8.0.200.0080.00016.96
8.0.190.0040.00416.98
8.0.180.0060.00617.03
8.0.170.0060.00317.00
8.0.160.0040.00417.00
8.0.150.0000.00716.80
8.0.140.0070.00016.93
8.0.130.0030.00313.30
8.0.120.0040.00416.89
8.0.110.0000.00716.88
8.0.100.0040.00416.87
8.0.90.0040.00316.79
8.0.80.0080.00816.98
8.0.70.0040.00416.78
8.0.60.0040.00416.89
8.0.50.0040.00416.73
8.0.30.0110.00817.21
8.0.20.0110.01117.40
8.0.10.0000.00817.11
8.0.00.0080.01316.75
7.4.330.0000.00515.13
7.4.320.0000.00716.55
7.4.300.0060.00016.61
7.4.290.0000.00716.62
7.4.280.0050.00216.63
7.4.270.0000.00716.65
7.4.260.0000.00716.63
7.4.250.0000.00716.55
7.4.240.0030.00316.60
7.4.230.0070.00016.69
7.4.220.0030.01716.66
7.4.210.0090.00516.50
7.4.200.0040.00416.43
7.4.160.0120.00316.59
7.4.150.0110.02117.40
7.4.140.0120.00917.86
7.4.130.0100.00916.62
7.4.120.0080.01216.54
7.4.110.0100.01016.74
7.4.100.0120.00616.56
7.4.90.0100.01416.64
7.4.80.0060.01919.39
7.4.70.0150.00616.50
7.4.60.0080.01116.44
7.4.50.0040.00416.35
7.4.40.0030.01316.57
7.4.30.0060.01116.52
7.4.00.0070.00814.99
7.3.330.0000.00613.22
7.3.320.0030.00313.13
7.3.310.0000.00716.23
7.3.300.0030.00316.27
7.3.290.0100.00316.34
7.3.280.0110.00916.28
7.3.270.0100.00717.40
7.3.260.0070.01316.36
7.3.250.0080.01016.57
7.3.240.0090.00916.32
7.3.230.0060.01216.39
7.3.210.0100.01316.36
7.3.200.0120.00616.51
7.3.190.0130.00616.31
7.3.180.0090.00816.56
7.3.170.0000.01616.43
7.3.160.0030.01416.38
7.3.120.0100.00614.59
7.3.110.0040.01214.66
7.3.100.0030.00914.71
7.3.90.0000.01214.64
7.3.80.0030.01215.16
7.3.70.0080.00514.75
7.3.60.0040.01114.82
7.3.50.0080.00414.93
7.3.40.0000.01314.86
7.3.30.0090.00314.66
7.3.20.0000.01116.39
7.3.10.0040.01116.67
7.3.00.0000.01116.82
7.2.330.0110.00716.71
7.2.320.0110.00516.39
7.2.310.0100.00616.37
7.2.300.0060.00916.74
7.2.290.0130.00316.63
7.2.250.0040.01514.90
7.2.240.0030.01414.84
7.2.230.0000.01014.69
7.2.220.0040.00715.20
7.2.210.0030.01015.02
7.2.200.0000.01515.05
7.2.190.0090.00615.02
7.2.180.0000.01314.96
7.2.170.0030.00615.02
7.2.00.0080.00819.35
7.1.330.0120.00315.95
7.1.320.0030.00515.83
7.1.310.0070.00315.90
7.1.300.0110.00415.54
7.1.290.0000.01215.71
7.1.280.0060.00615.54
7.1.270.0040.01115.83
7.1.260.0030.01315.81
7.1.200.0000.01215.63
7.1.100.0070.00718.04
7.1.70.0090.00916.86
7.1.60.0160.00817.22
7.1.50.0100.01416.93
7.1.40.0190.00616.39
7.1.30.0140.01016.50
7.1.20.0170.00316.46
7.1.10.0100.01316.48
7.1.00.0150.00416.71
7.0.200.0150.00316.63
7.0.190.0050.01016.71
7.0.180.0120.00616.02
7.0.170.0160.00016.19
7.0.160.0120.00416.17
7.0.150.0110.00416.28
7.0.140.0190.00816.25
7.0.130.0100.01316.46
7.0.120.0140.00716.51
7.0.110.0090.00616.52
7.0.100.0170.00416.48
7.0.90.0050.01016.33
7.0.80.0050.01116.45
7.0.70.0120.00816.25
7.0.60.0070.01116.32
7.0.50.0110.00816.14
7.0.40.0100.00314.70
7.0.30.0040.00914.70
7.0.20.0080.00514.70
7.0.10.0060.01214.70
7.0.00.0060.00614.70
5.6.300.0070.04620.81
5.6.290.0070.04620.59
5.6.280.0120.03721.09
5.6.270.0000.06621.01
5.6.260.0060.05520.88
5.6.250.0100.04020.89
5.6.240.0070.05521.08
5.6.230.0000.04920.93
5.6.220.0030.04920.89
5.6.210.0110.04220.99
5.6.200.0080.04620.88
5.6.190.0060.04521.00
5.6.180.0100.03920.85
5.6.170.0100.04120.84
5.6.160.0100.03721.07
5.6.150.0100.03921.00
5.6.140.0030.04420.91
5.6.130.0100.03921.04
5.6.120.0090.04121.06
5.6.110.0100.04320.74
5.6.100.0040.04320.79
5.6.90.0030.05720.95
5.6.80.0030.04220.35
5.6.70.0040.04320.12
5.6.60.0220.04120.22
5.6.50.0060.04420.26
5.6.40.0100.04020.20
5.6.30.0040.05020.42
5.6.20.0160.04020.37
5.6.10.0000.04620.19
5.6.00.0030.05420.28
5.5.380.0030.03917.61
5.5.370.0030.05417.48
5.5.360.0160.02917.51
5.5.350.0040.05217.57
5.5.340.0030.04917.71
5.5.330.0070.03818.10
5.5.320.0060.05218.01
5.5.310.0000.05117.84
5.5.300.0000.04318.09
5.5.290.0090.03417.86
5.5.280.0000.05418.00
5.5.270.0060.04417.82
5.5.260.0090.03617.82
5.5.250.0030.03917.91
5.5.240.0060.04117.52
5.5.230.0030.04117.39
5.5.220.0120.03417.46
5.5.210.0030.06217.47
5.5.200.0210.03217.36
5.5.190.0030.04317.10
5.5.180.0030.03817.43
5.5.160.0000.04417.45
5.5.150.0000.04017.43
5.5.140.0060.03517.43
5.5.130.0030.04317.43
5.5.120.0030.04117.35
5.5.110.0040.04417.38
5.5.100.0030.03917.26
5.5.90.0090.03517.28
5.5.80.0060.04217.30
5.5.70.0130.03617.25
5.5.60.0070.03717.34
5.5.50.0100.03217.28
5.5.40.0040.04817.32
5.5.30.0100.03317.29
5.5.20.0030.03817.32
5.5.10.0040.05017.33
5.5.00.0150.03517.32
5.4.450.0000.04819.37
5.4.440.0030.04419.40
5.4.430.0060.04419.27
5.4.420.0000.04319.30
5.4.410.0130.04119.29
5.4.400.0000.04819.12
5.4.390.0030.03818.94
5.4.380.0030.04818.92
5.4.370.0000.04519.21
5.4.360.0060.03819.09
5.4.350.0060.03519.20
5.4.340.0000.04519.06
5.4.320.0060.03619.04
5.4.310.0000.04119.07
5.4.300.0190.02819.20
5.4.290.0030.04119.13
5.4.280.0030.03819.05
5.4.270.0130.04719.09
5.4.260.0070.03618.98
5.4.250.0070.04319.06
5.4.240.0070.04018.91
5.4.230.0030.04518.90
5.4.220.0040.04218.97
5.4.210.0030.04518.91
5.4.200.0000.04719.13
5.4.190.0070.03519.05
5.4.180.0100.03819.20
5.4.170.0030.04219.10
5.4.160.0070.03718.96
5.4.150.0030.04418.90
5.4.140.0130.03516.51
5.4.130.0000.04516.81
5.4.120.0100.03616.82
5.4.110.0070.04516.78
5.4.100.0160.03016.56
5.4.90.0190.02916.55
5.4.80.0070.04416.76
5.4.70.0080.04116.79
5.4.60.0130.03616.75
5.4.50.0120.04116.70
5.4.40.0180.03216.77
5.4.30.0150.03616.60
5.4.20.0000.05416.56
5.4.10.0070.04916.40
5.4.00.0070.04416.21
5.3.290.0000.04114.97
5.3.280.0030.04014.87
5.3.270.0070.04714.93
5.3.260.0070.04914.80
5.3.250.0130.03614.70
5.3.240.0090.03814.89
5.3.230.0070.04014.80
5.3.220.0000.04214.94
5.3.210.0030.04114.78
5.3.200.0110.03414.84
5.3.190.0070.08014.70
5.3.180.0100.03814.93
5.3.170.0040.04514.95
5.3.160.0040.04614.70
5.3.150.0040.03914.70
5.3.140.0180.03414.70
5.3.130.0090.04014.86
5.3.120.0150.03014.70
5.3.110.0040.04514.75
5.3.100.0130.03014.70
5.3.90.0100.03614.70
5.3.80.0040.04014.70
5.3.70.0070.03614.70
5.3.60.0000.04214.70
5.3.50.0070.03414.70
5.3.40.0060.03914.70
5.3.30.0040.04414.70
5.3.20.0030.03714.70
5.3.10.0070.03314.70
5.3.00.0070.04114.70

preferences:
32.27 ms | 401 KiB | 5 Q