Latin alphabet cipher | function for calculating the encryption ; Driver Code
< ? php function cipher ( $ str ) { if ( ! ctype_alpha ( $ str ) ) { printf ( " Enter ▁ only ▁ " + " alphabets ▁ and ▁ space STRNEWLINE " ) ; return ; } printf ( " Encrypted ▁ Code ▁ using ▁ " ) ; printf ( " Latin ▁ Alphabet STRNEWLINE " ) ; for ( $ i = 0 ; $ i < strlen ( $ str ) ; $ i ++ ) { if ( $ str [ $ i ] >= ' A ' && $ str [ $ i ] <= ' Z ' ) echo ( ord ( $ str [ $ i ] ) - 65 + 1 ) . " ▁ " ; else if ( $ str [ $ i ] >= ' a ' && $ str [ $ i ] <= ' z ' ) echo ( ord ( $ str [ $ i ] ) - 97 + 1 ) . " ▁ " ; } echo " STRNEWLINE " ; } $ str = " geeksforgeeks " ; cipher ( $ str ) ; ? >