3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function encrypt($string) { $pad = 'abcde'; $encrypted_string = ""; for ($i = 0; $i < strlen($string); $i++) { $char = $string[$i]; $ord_shift = ctype_upper($shift_char) ? 65 : 97; if ($i < strlen($pad) && preg_match("/[a-z]/i", $char)) { $shift_char = $pad[$i]; $shift_amount = ord($shift_char) - $ord_shift; if ($shift_amount) { $ord_char = ord($char) + $shift_amount; while ($ord_char > $ord_shift + 26) { $ord_char -= 26; } $char = chr($ord_char); } } $encrypted_string .= $char; } return $encrypted_string; } encrypt('this is a test');
Output for 5.0.4 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
Notice: Undefined variable: shift_char in /in/YoLVf on line 8
Output for 4.3.0 - 5.0.3
Notice: Undefined variable: shift_char in /in/YoLVf on line 8