PHPize Online / SQLize Online  /  SQLtest Online

A A A
Share      Blog   Popular
Copy Format Clear
Copy Clear
Copy Format Clear
<?php function secretCode($text,$key){ $result=""; for($i=0;$i<strlen($text);$i++){ $char=$text[$i]; if(ctype_alpha($char)){ $shifted=ord($char)+$key; if(ctype_upper($char)){ $result.=chr((($shifted-65)%26)+65); }else{ $result.=chr((($shifted-97)%26)+97); } }else{ $result.=$char; } } return $result; } echo secretCode ('Prinvet!',2);
Show:  
Copy Clear