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);
Output for git.master_jit, git.master, rfc.property-hooks
bin2hex: \x62\x61\x73\x65\x36\x34\x5f\x64\x65\x63\x6f\x64\x65 unpack: \x62\x61\x73\x65\x36\x34\x5f\x64\x65\x63\x6f\x64\x65 sprintf: \x62\x61\x73\x65\x36\x34\x5F\x64\x65\x63\x6F\x64\x65 ------------------------- decoded: hex2bin: base64_decode pack: base64_decode sscanf + vprintf base64_decode

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
88.52 ms | 406 KiB | 5 Q