note 111762 deleted from features.commandline.interactive by aharvey

From: Date: Tue, 26 Mar 2013 16:06:15 +0000
Subject: note 111762 deleted from features.commandline.interactive by aharvey
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-194217@lists.php.net to get a copy of this message
Note Submitter: Pavle Predic ---- Here's an improved version of the script for emulating interactive shell on windows: <?php $fh = fopen('php://stdin', 'r'); $cmd = ''; $bcLvl = 0; while (true) { $line = rtrim(fgets($fh)); $bcLvl += substr_count($line, '{') - substr_count($line, '}'); $cmd.= $line; if ($bcLvl > 0 or substr($cmd, -1) !== ';') continue; eval($cmd); $cmd = ''; } ?> Save this and run from console. You will be able to write functions and classes on multiple lines.

« previous php.notes (#194217) next »