Jump to content

[SOLVED] Eliminating the new line


ErcFrtz

Recommended Posts

Hello, I have the following code:

if(file_exists($pigIDFile) && is_readable($pigIDFile))
{
    $readFile = file($pigIDFile);
    foreach($readFile as $line)
    {
      $pigIDarray[] = $line;
    }
  }

 

My question is with this code it puts the new line character at the end of each entry and I just want each line without that new line character. How do I eliminate it from $line so that my array is populated with each line without the new line character?

Link to comment
https://forums.phpfreaks.com/topic/180458-solved-eliminating-the-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.