The idea of this lies on the surface, but almost everyone I showed this thing to was surprised and asked to give them a link. Although the idea is simple, almost everyone knows about stdin and readline.
So, an interactive console is simple and very useful. With history and autocompletion.

There are, however, three questions and two problems.
')
1) windows. In windows, there is no readline, no, accordingly, autocomplete. Only stdin. For him, the wrapper is written, but esc-sequences of color changes, unfortunately, do not work (but you just need to fix it).
2) readline + libedit / libreadline. They need (preferably, more correctly) to install. You can already have the last library (if not, then I have it installed by the command “emerge libedit”), then you need to compile the
readline php extension. This is done like this: cd php-5.xx / ext / readline && phpize && ./configure && make && make install
3) I personally had to configure libedit. The ~ / .editrc file looks like this to me:
bind "^R" em-inc-search-prev
bind "^[O5C" vi-next-word
bind "^[O5D" vi-prev-word
bind "^[[1~" ed-move-to-beg
bind "^[[4~" ed-move-to-end
bind "^[[3~" ed-delete-next-char
Now about the problems. The first is that the code inside eval can be controlled by a parse error, but not by a fatal error. Accordingly, with fatal errors, the entire console crashes. In fairness, I will say that my fatal error fell out only a couple of times, most of the errors - or notice, or parse error.
The second problem is the crooked readline extension, which does not accept the answer “no options” from the autocomplete function. I could not overcome it, and now, if you press Tab immediately or after the space, without entering a character, a list of files will be displayed, and this sometimes interferes.
But in general, such a console is quite useful.
The sources are on
Google code , please.
PS (for those who are bored): which will output the line
for ($i='a';$i<='z';$i++) echo $i.' ';
for ($i='a';$i<='z';$i++) echo $i.' ';
?