Browse Source

repl: Add loop and handle quit event

master
Elis Hirwing 3 years ago
parent
commit
ece578aea1
Signed by: etu GPG Key ID: D57EFA625C9A925F
  1. 10
      repl.php

10
repl.php

@ -9,3 +9,13 @@ echo 'Quitting: q'.PHP_EOL;
echo PHP_EOL;
echo 'Default item-name is "box".'.PHP_EOL;
echo PHP_EOL;
while (true) {
// Read user input
$line = trim(fgets(STDIN));
// Handle quit
if (strtolower($line) === 'q') {
break;
}
}

Loading…
Cancel
Save