3v4l.org

run code in 300+ PHP versions simultaneously
<?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; } echo encode("Please Encode Me!","This is a key"); ?>
Output for git.master, git.master_jit, rfc.property-hooks
Warning: Undefined variable $j in /in/hEsVF on line 8 Warning: Undefined variable $j in /in/hEsVF on line 9 Deprecated: substr(): Passing null to parameter #2 ($offset) of type int is deprecated in /in/hEsVF on line 9 Warning: Undefined variable $j in /in/hEsVF on line 10 Warning: Undefined variable $hash in /in/hEsVF on line 11 p3e4e4241674d2r4m4i5o464a4f2p3k5c2

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:
48.36 ms | 402 KiB | 8 Q