3v4l.org

run code in 300+ PHP versions simultaneously
<?php function _hex2bin($hex) { $hex = strtoupper($hex); $hexLen = strlen($hex); $bin = []; for ($i = 0; $i < $hexLen; $i++) { $char = $hex[$i]; $bin[] = str_pad(base_convert($char, 16, 2), 4, '0', STR_PAD_LEFT); } return implode("", $bin); } echo _hex2bin("152F302436152F302435152F302434152F302433152F302433");
Output for 7.0.0 - 7.0.25, 7.1.0 - 7.1.20, 7.2.6 - 7.2.33, 7.3.16 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.4, 8.3.6
00010101001011110011000000100100001101100001010100101111001100000010010000110101000101010010111100110000001001000011010000010101001011110011000000100100001100110001010100101111001100000010010000110011
Output for 8.3.5
Warning: PHP Startup: Unable to load dynamic library 'sodium.so' (tried: /usr/lib/php/8.3.5/modules/sodium.so (libsodium.so.23: cannot open shared object file: No such file or directory), /usr/lib/php/8.3.5/modules/sodium.so.so (/usr/lib/php/8.3.5/modules/sodium.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0 00010101001011110011000000100100001101100001010100101111001100000010010000110101000101010010111100110000001001000011010000010101001011110011000000100100001100110001010100101111001100000010010000110011

preferences:
151.55 ms | 402 KiB | 180 Q