3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?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).
Note: hhvm uses a JIT which only kicks in after a few runs. Since we run scripts only once, hhvm always runs slower.

VersionSystem time (s)User time (s)Memory (MiB)
7.2.00.0080.00819.35
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
hhvm-3.17.30.0790.12996.40
hhvm-3.15.40.0490.11289.85
hhvm-3.13.20.0500.08799.72
hhvm-3.12.140.0340.02576.69
hhvm-3.11.10.0590.11891.80
hhvm-3.10.10.0450.10688.39
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