note 111762 added to features.commandline.interactive

From: Date: Tue, 26 Mar 2013 10:22:32 +0000
Subject: note 111762 added to features.commandline.interactive
Groups: php.notes 
Request: Send a blank email to php-notes+get-194207@lists.php.net to get a copy of this message
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. ---- Server IP: 69.147.83.199 Probable Submitter: 178.148.4.2 ---- Manual Page -- http://php.net/manual/en/features.commandline.interactive.php Edit -- https://master.php.net/note/edit/111762 Del: integrated -- https://master.php.net/note/delete/111762/integrated Del: useless -- https://master.php.net/note/delete/111762/useless Del: bad code -- https://master.php.net/note/delete/111762/bad+code Del: spam -- https://master.php.net/note/delete/111762/spam Del: non-english -- https://master.php.net/note/delete/111762/non-english Del: in docs -- https://master.php.net/note/delete/111762/in+docs Del: other reasons-- https://master.php.net/note/delete/111762 Reject -- https://master.php.net/note/reject/111762 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#194207) next »