Home>

I'm new to programming and just started studying PHP.
I want to output Hello, world! To the terminal.
The% will be added at the end with a shadow.
Normally, it doesn't seem to come with%, but what happened to this?

○○ @ ○○○ MBP php% php test.php
Hello, world!%
Corresponding source code
<? php
 echo "Hello!";
 ?>
What I tried

When I ran it with php -a,% was not displayed.

Supplementary information (FW/tool version, etc.)

vscode
PHP 7.4.12

php
  • Answer # 1

    From the terminal prompt, I think it's working locally on macOS.
    At this time, if you have not tampered with the login shell, the shell used is zsh.

    So, zsh has a shadow indicating "no line breaks" if there is no line break at the end of standard output.%%Is additionally output and ends after a line break.

    * A question with the same content was posted before

    this%%If you don't want to get the message, just start a new line.

    <? php
    --echo "Hello!";
    + echo "Hello! \ N";
     ?>