commit c42f9e410972b3eda6c85fa78da4aa88b18c52ff Author: Christer Warén Date: Fri Jun 17 12:51:00 2022 +0300 Init diff --git a/characters.json b/characters.json new file mode 100644 index 0000000..e6f7ea1 --- /dev/null +++ b/characters.json @@ -0,0 +1,8 @@ +{ + "A": "4", + "E": "3", + "I": "1", + "O": "0", + "S": "5", + "T": "7" +} diff --git a/index.php b/index.php new file mode 100644 index 0000000..2f41263 --- /dev/null +++ b/index.php @@ -0,0 +1,59 @@ + $value){ + $input = str_replace($key, $value, $input); + } + + echo "\n"."\n"; + + echo "Answer: "."\n"; + echo "$input"."\n"."\n"; + } +} + +if(isset($input) && $input != '' && $input == '2'){ + echo "Insert text: "."\n"; + $input = trim(fgets($stdin)); + + if(isset($input) && $input != ''){ + + $input = mb_strtoupper($input); + + foreach($characters as $key => $value){ + $input = str_replace($value, $key, $input); + } + + echo "\n"."\n"; + + echo "Answer: "."\n"; + echo "$input"."\n"."\n"; + } +} + + + +?> diff --git a/run.sh b/run.sh new file mode 100644 index 0000000..28ad377 --- /dev/null +++ b/run.sh @@ -0,0 +1 @@ +docker run -it --rm --name php -v "$PWD":/usr/src/myapp -w /usr/src/myapp php:7-cli php index.php