Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $userLogin = [];
- $count = 0;
- while(true) {
- $input = trim(fgets(STDIN));
- if ($input == "login") {
- break;
- }
- $line = explode(' -> ', $input);
- $userLogin[$line[0]] = $line[1];
- }
- while(true) {
- $input = trim(fgets(STDIN ));
- if ($input == "end"){
- break;
- }
- $line = explode(' -> ', $input);
- if (!key_exists || !value_exists) {
- echo "$key: login failed" . PHP_EOL;
- $count++;
- } else {
- echo "$key: logged in successfully" . PHP_EOL;
- }
- }
- echo "unsuccessful login attempts: $count";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement