0

When i use echo command in my code to print something to the screen it will add % character to the last of word !

but i face this problem only when i run the PHP application using the Linux terminal using the command php script.php

The code is

<?php
echo "Please Type The Hash : ";
$str = trim(fgets(STDIN,1024));
echo $str;
?>
Black Hawk
  • 33
  • 1
  • 3

1 Answers1

0

Some shell interpreters (for example ZSH) adds "%" and newline at end of subprocess output to distinguish between output of process and input prompt of shell.

Add a newline to your ouput:

echo $str, "\n";
Mike S.
  • 1,995
  • 13
  • 25