Greetings fellow programmers!
Is there a way to get PHPs interactive shell, php -a
, to behave more like Rails console or the console in Chrome? I have looked through the flags for the php-command, but no dice.
What I get:
php > $a = 0;
php > $a;
php > echo $a;
0php >
What I want
php > $a = 0;
0
php > $a;
0
php > echo $a;
0
php >
You have at least three possibilities to solve this problem:
PHP_EOL
to all your echo
: echo $a . PHP_EOL
echo $a . PHP_EOL
; As of 2022, PsySH seems to be a modern maintained valid solution for the asked question:
Psy Shell v0.11.5 (PHP 7.4.3 — cli) by Justin Hileman
>>> $a = 0
=> 0
>>> $a
=> 0
>>> echo $a
0⏎
All the more:
echo
expression eval
statement dropped anywhere in a code base is enough to set a breakpoint powered by this REPL
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.