Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $key = 11;
- $vhod = 'YL LOKUPKUEDBTKJUEDBLU';
- $abeceda = array(1=>'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z',' ');
- $niz = strtoupper($vhod);
- $array = str_split($niz);
- foreach($array as $index => $element)
- {
- $value = array_search($element, $abeceda);//crke zamenjamo s številkami
- $value = $value - $key;
- if($value <= 0)
- {
- $value = $value + count($abeceda);
- }
- $hash = $abeceda[$value];
- $output[] = $hash;
- }
- foreach($output as $index => $element)
- {
- if($element == null)
- {
- $output[$index] = ' ';
- }
- }
- $izpis = implode('',$output);
- echo $izpis;
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement