Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP interactive shell and NO newline with echo

Tags:

shell

php

I have compiled PHP with the --with-readline option and I got the interactive shell, but I have an annoying problem, when I echo something the echo doesn't print a newline character I mean:

****@****-PC ~ $ php -a
Interactive mode enabled

php > echo 1+2;
3php > echo "Hello World!";
Hello World!php >

Where is the problem? How can I resolve it? Because watching here it prints a newline.

like image 473
zer0uno Avatar asked Oct 24 '25 14:10

zer0uno


1 Answers

If you want to force the interactive mode to always output a newline, you can declare it as such on startup:

php -dcli.prompt="\nphp> " -a

(Or rather adapt the php.ini)

like image 115
mario Avatar answered Oct 26 '25 05:10

mario



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!