3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function base16Encode($arg){ $ret = ''; for($i=0; $i < strlen($arg); $i++){ $tmp = ord(substr($arg, $i, 1)); $ret .= dechex($tmp); } return $ret; } function encode($text) { return bin2hex($text); } function decode($base16){ return pack("H*", $base16); } function encrypt($key, $link){ $cp = mcrypt_module_open(MCRYPT_RIJNDAEL_128, '', 'cbc', ''); @mcrypt_generic_init($cp, $key, $key); $enc = mcrypt_generic($cp, $link); mcrypt_generic_deinit($cp); mcrypt_module_close($cp); return $enc; } $key="KEY"; echo $transmitKey = base16Encode($key); echo '\r\n\r\n'; echo decode($transmitKey); $link="URL"; $crypted = base64_encode(encrypt($key, $link)); //echo $crypted;
based on dseN1
Output for 7.0.0 - 7.3.0rc3
4b4559\r\n\r\nKEY Fatal error: Uncaught Error: Call to undefined function mcrypt_module_open() in /in/j32O0:22 Stack trace: #0 /in/j32O0(37): encrypt('KEY', 'URL') #1 {main} thrown in /in/j32O0 on line 22
Process exited with code 255.
Output for hhvm-3.15.4
4b4559\r\n\r\nKEY
Output for 5.6.0 - 5.6.30
4b4559\r\n\r\nKEY Fatal error: Call to undefined function mcrypt_module_open() in /in/j32O0 on line 22
Process exited with code 255.