echo "{$router_identity}>"; } else { $action = $sentence[0]; echo "{$router_identity} {$action}>"; } // read a line of input $input = trim(fgets(STDIN)); if (strlen($input) > 0 && $input[0] != '/') { // if there is input that does not begin with "/" if ($input == 'quit' || $input == 'exit' || $input == chr(4)) { // check for one or more ways to quit $input = '/quit'; } else { if ($input == 'setdebug') { // toggle debug output $dbg = $mt->getDebug(); $mt->setDebug(!$dbg); if ($dbg) { echo "Debugging disabled\n"; } else { echo "Debugging enabled\n"; } continue; } } } if ($input == '' || $input == '/quit' || substr($input, -1) == ';') { // if input was empty, or quit - send sentence if ($input == '/quit') { $sentence = array($input); }