3v4l.org

run code in 300+ PHP versions simultaneously
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <script type="text/javascript" src="js/jquery.js"></script> <script type="text/javascript" src="js/font-resize.js"></script> <script type="text/javascript"> $(document).ready(function() { fontResize(); $(window).bind('resize', function() { fontResize(); }); } ); </script> <?php function encode($string,$key) { $key = sha1($key); $strLen = strlen($string); $keyLen = strlen($key); for ($i = 0; $i < $strLen; $i++) { $ordStr = ord(substr($string,$i,1)); if ($j == $keyLen) { $j = 0; } $ordKey = ord(substr($key,$j,1)); $j++; $hash .= strrev(base_convert(dechex($ordStr + $ordKey),16,36)); } return $hash; } function decode($string,$key) { $key = sha1($key); $strLen = strlen($string); $keyLen = strlen($key); for ($i = 0; $i < $strLen; $i+=2) { $ordStr = hexdec(base_convert(strrev(substr($string,$i,2)),36,16)); if ($j == $keyLen) { $j = 0; } $ordKey = ord(substr($key,$j,1)); $j++; $hash .= chr($ordStr - $ordKey); } return $hash; } ?> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title><? echo htmlspecialchars($_GET["name"]) . '!'; ?></title> <style type="text/css"> .BIG { font-size: 1050%; font-weight: bold; font-family: "Palatino Linotype", "Book Antiqua", Palatino, serif; text-align: center; } </style> </head> <body class="BIG"> <?php $name = htmlspecialchars($_GET['name']); $urlENC = encode( $name ,"whateverkey"); $urlDEC = decode( $urlENC ,"whateverkey"); echo htmlspecialchars($_GET["url"]) . ''; //echo htmlspecialchars($_POST['name']); //echo $urlENC; ?> <br /> <? echo $urlDEC; ?> </body>

preferences:
65.63 ms | 402 KiB | 5 Q