Jump to content

Remove New Line


The Little Guy

Recommended Posts

I am writing a script for the command line, and cant figure out why this is happening....

 

I have this, and it works, just displays wrong:

fwrite(STDOUT, "What do you want to name the table? ");
$tblName = fgets(STDIN);

echo 'Table '.$tblName.' created.';

 

it displays like this:

Table blocks

created.

 

If I do this with a trim:

fwrite(STDOUT, "What do you want to name the table? ");
$tblName = trim(fgets(STDIN),"\n");

echo 'Table '.$tblName.' created.';

 

it displays this:

created.cks

 

So basically, I want it to display the first example, but have it on one line. How can I fix it?

Link to comment
https://forums.phpfreaks.com/topic/197381-remove-new-line/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.