3v4l.org

run code in 300+ PHP versions simultaneously
<?php $word = 'base64_decode'; echo 'bin2hex: ' . PHP_EOL; echo implode(array_map(function($char) { return '\x' . bin2hex($char); }, str_split($word))) . PHP_EOL . PHP_EOL; echo 'unpack: ' . PHP_EOL; echo implode(array_map(function($char) { return '\x' . implode(unpack('H*', $char)); }, str_split($word))) . PHP_EOL . PHP_EOL; echo 'sprintf: ' . PHP_EOL; echo $encoded = implode(array_map(function($char) { return sprintf('\x%02X', ord($char)); }, (array) str_split($word))); echo PHP_EOL . PHP_EOL; echo '-------------------------' . PHP_EOL . PHP_EOL . 'decoded:' . PHP_EOL; $hexadecimal = str_replace('\x', '', $encoded); echo 'hex2bin:' . PHP_EOL; echo hex2bin($hexadecimal) . PHP_EOL . PHP_EOL; echo 'pack:' . PHP_EOL; echo pack('H*', $hexadecimal) . PHP_EOL . PHP_EOL; echo 'sscanf + vprintf' . PHP_EOL; vprintf(str_repeat('%c', count($f = sscanf($hexadecimal, str_repeat('%02X', substr_count($encoded , '\x'))))), $f);

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.4.140.0100.01017.36
8.4.130.0110.00917.54
8.4.120.0140.00520.59
8.4.110.0100.00822.45
8.4.100.0100.01117.64
8.4.90.0120.00820.50
8.4.80.0040.00518.98
8.4.70.0110.00720.75
8.4.60.0130.00820.64
8.4.50.0110.00417.73
8.4.40.0210.00017.80
8.4.30.0030.01820.41
8.4.20.0040.01619.68
8.4.10.0160.00321.98
8.3.270.0110.00816.61
8.3.260.0130.00616.80
8.3.250.0110.00818.82
8.3.240.0110.00817.14
8.3.230.0070.01116.71
8.3.220.0040.00418.88
8.3.210.0120.00716.76
8.3.200.0040.00516.81
8.3.190.0150.00417.36
8.3.180.0080.01118.39
8.3.170.0190.00016.61
8.3.160.0070.01116.51
8.3.150.0110.00718.88
8.3.140.0130.00616.63
8.3.130.0110.01118.59
8.3.120.0050.00319.02
8.3.110.0150.01118.72
8.3.100.0270.00116.63
8.3.90.0120.01117.45
8.3.80.0160.01117.49
8.3.70.0260.00516.57
8.3.60.0200.01216.52
8.3.50.0130.00818.62
8.3.40.0160.00318.74
8.3.30.0130.00918.07
8.3.20.0180.00320.67
8.3.10.0090.00621.07
8.3.00.0080.00421.81
8.2.290.0110.00920.50
8.2.280.0100.00922.43
8.2.270.0050.00318.31
8.2.260.0030.00620.75
8.2.250.0070.00716.97
8.2.240.0160.00317.12
8.2.230.0110.00319.41
8.2.220.0130.00520.31
8.2.210.0090.00821.77
8.2.200.0130.00217.40
8.2.190.0230.00216.40
8.2.180.0160.00720.99
8.2.170.0160.00718.31
8.2.160.0240.00520.13
8.2.150.0140.00721.67
8.2.140.0170.00421.08
8.2.130.0220.00421.72
8.2.120.0220.00618.97
8.2.110.0200.00218.87
8.2.100.0170.00718.65
8.2.90.0130.00417.84
8.2.80.0120.00618.54
8.2.70.0110.00817.55
8.2.60.0180.00517.70
8.2.50.0140.00717.75
8.2.40.0080.00817.82
8.2.30.0140.00717.71
8.2.20.0120.00418.53
8.2.10.0150.00717.78
8.2.00.0130.00818.11
8.1.330.0090.00922.05
8.1.320.0090.01116.23
8.1.310.0000.00818.22
8.1.300.0040.00418.09
8.1.290.0170.00917.46
8.1.280.0250.00420.99
8.1.270.0240.00320.95
8.1.260.0190.00721.83
8.1.250.0170.00822.65
8.1.240.0130.01020.52
8.1.230.0180.00719.06
8.1.220.0120.00617.61
8.1.210.0180.00517.56
8.1.200.0140.00717.44
8.1.190.0130.00617.41
8.1.180.0150.00517.66
8.1.170.0170.00517.81
8.1.160.0150.00617.89
8.1.150.0180.00317.85
8.1.140.0130.00917.33
8.1.130.0160.00417.80
8.1.120.0110.00617.44
8.1.110.0120.00817.38
8.1.100.0140.00517.34
8.1.90.0120.00517.46
8.1.80.0150.00417.45
8.1.70.0160.00317.42
8.1.60.0190.00517.53
8.1.50.0170.00717.51
8.1.40.0200.00417.54
8.1.30.0160.00717.47
8.1.20.0120.00717.57
8.1.10.0130.00417.46
8.1.00.0160.00417.34
8.0.300.0150.00917.01
8.0.290.0200.00416.95
8.0.280.0160.00317.56
8.0.270.0180.00217.41
8.0.260.0150.00517.50
8.0.250.0160.00417.22
8.0.240.0140.00617.14
8.0.230.0160.00517.15
8.0.220.0160.00517.07
8.0.210.0170.00417.14
8.0.200.0170.00517.12
8.0.190.0180.00417.15
8.0.180.0150.00817.19
8.0.170.0150.00717.16
8.0.160.0180.00617.12
8.0.150.0160.00617.12
8.0.140.0180.00517.12
8.0.130.0190.00417.13
8.0.120.0120.01217.09
8.0.110.0170.00317.06
8.0.100.0170.00517.11
8.0.90.0170.00517.13
8.0.80.0200.00217.09
8.0.70.0190.00417.03
8.0.60.0170.00517.13
8.0.50.0150.00617.10
8.0.30.0170.00517.09
8.0.20.0180.00317.14
8.0.10.0210.00217.16
7.4.330.0110.00616.73
7.4.320.0150.00117.00
7.4.300.0120.00616.96
7.4.290.0180.00317.00
7.4.280.0150.00517.02
7.4.270.0180.00416.99
7.4.260.0140.00717.00
7.4.250.0150.00516.90
7.4.240.0120.00416.98
7.4.230.0120.00516.90
7.4.220.0120.00316.89
7.4.210.0170.00417.02
7.4.200.0130.00716.96
7.4.190.0140.00617.04
7.4.180.0150.00616.99
7.4.160.0160.00617.01
7.4.150.0150.00417.04
7.4.140.0130.00616.91
7.4.130.0150.00316.93
7.4.120.0140.00516.99
7.4.110.0140.00516.94
7.4.100.0140.00516.94
7.4.90.0130.00616.95
7.4.80.0140.00516.98
7.4.70.0150.00516.93
7.4.60.0130.00616.98
7.4.50.0150.00416.88
7.4.40.0160.00216.90
7.4.30.0130.00516.90
7.4.20.0120.00616.93
7.4.10.0150.00316.93
7.4.00.0140.00516.95

preferences:
30.66 ms | 403 KiB | 5 Q