Last active
April 10, 2019 03:28
-
-
Save hplc/ed5178315005c4dcdaa8766fcaf57973 to your computer and use it in GitHub Desktop.
PHP script to practice several LTE terms.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/php | |
<?php | |
$terms = [ | |
"LTE" => "Long Term Evolution", | |
"SAE" => "System Architecture Evolution", | |
"E-UTRAN" => "Evolved Universal Terrestrial Radio Access Network", | |
"EPC" => "Evolved Packet Core", | |
"EPS" => "Evolved Packet System", | |
"UE" => "User Equipment", | |
"MME" => "Mobility Management Entity", | |
"S-GW" => "Serving Gateway", | |
"P-GW" => "Packet Data Node Gateway" | |
]; | |
system("clear"); | |
$name = readline("Input Your Name: "); | |
system("date"); | |
$time_start = time(); | |
echo PHP_EOL; | |
echo "Hello, $name!"; | |
echo PHP_EOL; | |
$line = "Init"; | |
while ($term = current($terms)) { | |
$key = key($terms); | |
while ($line !== $term) { | |
if ($line !== "Init") { | |
echo "Wrong! Try again!" . PHP_EOL; | |
} | |
$line = readline("$key: "); | |
} | |
echo "Good!"; | |
$line = "Init"; | |
echo PHP_EOL; | |
next($terms); | |
} | |
system("date"); | |
$time_end = time(); | |
echo PHP_EOL; | |
$seconds = $time_end - $time_start; | |
echo "$name, you finished the test in " . $seconds . " seconds!"; | |
echo PHP_EOL; | |
echo "Great!!!"; | |
echo PHP_EOL; | |
$content = "$name: $seconds seconds, " . date('Y-m-d H:i:s', $time_end) . "\n"; | |
file_put_contents("./lte-terms.log", $content, FILE_APPEND | LOCK_EX); | |
while (true) { readline(); } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment