3v4l.org

run code in 300+ PHP versions simultaneously
<?php function decrypt ($str) { if(preg_match('%^[a-zA-Z0-9/+]*={0,2}$%',$str)) { $str = base64_decode($str); if ($str != "" && $str != null && $str != false) { $decStr = ""; for ($i=0; $i < strlen($str); $i+=3) { $array[$i/3] = substr($str,$i,3); } foreach($array as $s) { $a = $s^192; $decStr .= chr($a); } return $decStr; } return false; } return false; } echo decrypt("MTI5MTY0MTczMTY5MTc0"); ?> <?php function encrypt($str) { if(preg_match('%[a-zA-Z0-9/+]*={0,2}$%',$str)) { $str=base64_encode($str); if($str != "" && $str != null && $str != false) { $encStr=""; for($i=0;$i<strlen($str);$i+=1) { $a=$s^64; $encStr .=chr('MT'); $encStr .=chr($s); } return $encStr; } return false; } return false; } echo encrypt("Admin"); ?>
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.7
Admin Warning: Undefined variable $s in /in/8NK2c on line 44 Fatal error: Uncaught TypeError: chr(): Argument #1 ($codepoint) must be of type int, string given in /in/8NK2c:45 Stack trace: #0 /in/8NK2c(45): chr('MT') #1 /in/8NK2c(55): encrypt('QWRtaW4=') #2 {main} thrown in /in/8NK2c on line 45
Process exited with code 255.
Output for 7.4.0 - 7.4.25, 7.4.27 - 7.4.33
Admin Notice: Undefined variable: s in /in/8NK2c on line 44 Warning: chr() expects parameter 1 to be int, string given in /in/8NK2c on line 45 Notice: Undefined variable: s in /in/8NK2c on line 46 Notice: Undefined variable: s in /in/8NK2c on line 44 Warning: chr() expects parameter 1 to be int, string given in /in/8NK2c on line 45 Notice: Undefined variable: s in /in/8NK2c on line 46 Notice: Undefined variable: s in /in/8NK2c on line 44 Warning: chr() expects parameter 1 to be int, string given in /in/8NK2c on line 45 Notice: Undefined variable: s in /in/8NK2c on line 46 Notice: Undefined variable: s in /in/8NK2c on line 44 Warning: chr() expects parameter 1 to be int, string given in /in/8NK2c on line 45 Notice: Undefined variable: s in /in/8NK2c on line 46 Notice: Undefined variable: s in /in/8NK2c on line 44 Warning: chr() expects parameter 1 to be int, string given in /in/8NK2c on line 45 Notice: Undefined variable: s in /in/8NK2c on line 46 Notice: Undefined variable: s in /in/8NK2c on line 44 Warning: chr() expects parameter 1 to be int, string given in /in/8NK2c on line 45 Notice: Undefined variable: s in /in/8NK2c on line 46 Notice: Undefined variable: s in /in/8NK2c on line 44 Warning: chr() expects parameter 1 to be int, string given in /in/8NK2c on line 45 Notice: Undefined variable: s in /in/8NK2c on line 46 Notice: Undefined variable: s in /in/8NK2c on line 44 Warning: chr() expects parameter 1 to be int, string given in /in/8NK2c on line 45 Notice: Undefined variable: s in /in/8NK2c on line 46
Output for 7.4.26
Admin Warning: chr() expects parameter 1 to be int, string given in /in/8NK2c on line 45 Warning: chr() expects parameter 1 to be int, string given in /in/8NK2c on line 45 Warning: chr() expects parameter 1 to be int, string given in /in/8NK2c on line 45 Warning: chr() expects parameter 1 to be int, string given in /in/8NK2c on line 45 Warning: chr() expects parameter 1 to be int, string given in /in/8NK2c on line 45 Warning: chr() expects parameter 1 to be int, string given in /in/8NK2c on line 45 Warning: chr() expects parameter 1 to be int, string given in /in/8NK2c on line 45 Warning: chr() expects parameter 1 to be int, string given in /in/8NK2c on line 45
Output for 4.3.0 - 4.3.11, 4.4.0 - 4.4.9, 5.0.0 - 5.0.5, 5.1.0 - 5.1.6, 5.2.0 - 5.2.17, 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 7.3.32 - 7.3.33
Admin
Output for 5.5.0 - 5.5.35, 5.6.0 - 5.6.28, 7.0.0 - 7.0.20, 7.1.0 - 7.1.7, 7.2.29 - 7.2.33, 7.3.12 - 7.3.31
Admin Notice: Undefined variable: s in /in/8NK2c on line 44 Notice: Undefined variable: s in /in/8NK2c on line 46 Notice: Undefined variable: s in /in/8NK2c on line 44 Notice: Undefined variable: s in /in/8NK2c on line 46 Notice: Undefined variable: s in /in/8NK2c on line 44 Notice: Undefined variable: s in /in/8NK2c on line 46 Notice: Undefined variable: s in /in/8NK2c on line 44 Notice: Undefined variable: s in /in/8NK2c on line 46 Notice: Undefined variable: s in /in/8NK2c on line 44 Notice: Undefined variable: s in /in/8NK2c on line 46 Notice: Undefined variable: s in /in/8NK2c on line 44 Notice: Undefined variable: s in /in/8NK2c on line 46 Notice: Undefined variable: s in /in/8NK2c on line 44 Notice: Undefined variable: s in /in/8NK2c on line 46 Notice: Undefined variable: s in /in/8NK2c on line 44 Notice: Undefined variable: s in /in/8NK2c on line 46

preferences:
224.34 ms | 405 KiB | 342 Q