Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $inputFile = fopen("ksiazka1.txt", "r") or die("Nie mozna otworzyc pliku");
- $arr = array();
- while(!feof($inputFile))
- {
- $character = ord(fgetc($inputFile));
- #Sprawdzenie czy znak znajduje sie w przedziale a-z, A-Z
- if($character >= 65 and $character < 90 or $character >= 97 and $character < 122)
- {
- array_push($arr, $character + 1);
- }
- #Jezeli znak to z lub Z - zamiana na a, A
- else if($character == 90 or $character == 122)
- {
- array_push($arr, $character - 25);
- }
- #Pozostawienie znaku bez zmian
- else
- {
- array_push($arr, $character);
- }
- }
- fclose($inputFile);
- $output = "";
- foreach($arr as $val)
- {
- $output .= chr($val);
- }
- $outputFile = fopen("ksiazka2.txt", "w");
- fwrite($outputFile, $output);
- fclose($outputFile);
- echo "Sukces";
- ?>
Add Comment
Please, Sign In to add comment