Polybius Square Cipher | function to display polybius cipher text ; convert each character to its encrypted code ; finding row of the table ; finding column of the table ; if character is ' k ' ; if character is greater than ' j ' ; Driver Code ; print the cipher of "geeksforgeeks
< ? php function polybiusCipher ( $ s ) { $ row = 0 ; $ col = 0 ; for ( $ i = 0 ; $ i < strlen ( $ s ) ; $ i ++ ) { $ row = floor ( ( ord ( $ s [ $ i ] ) - ord ( ' a ' ) ) / 5 ) + 1 ; $ col = ( ( ord ( $ s [ $ i ] ) - ord ( ' a ' ) ) % 5 ) + 1 ; if ( $ s [ $ i ] == ' k ' ) { $ row = $ row - 1 ; $ col = 5 - $ col + 1 ; } else if ( $ s [ $ i ] >= ' j ' ) { if ( $ col == 1 ) { $ col = 6 ; $ row = $ row - 1 ; } $ col = $ col - 1 ; } echo ( $ row . $ col ) ; } echo ( " STRNEWLINE " ) ; } $ s = " geeksforgeeks " ; polybiusCipher ( $ s ) ; ? >