FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » SplFileObject always returns an extra "last" line -- why?
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: SplFileObject always returns an extra "last" line -- why? [message #186325 is a reply to message #186319] Wed, 25 June 2014 01:14 Go to previous message
kurtk(at)pobox(dot)com is currently offline  kurtk(at)pobox(dot)com
Messages: 10
Registered: May 2012
Karma:
Junior Member
> Actually the file has two lines, because you're having a line break (NL,
> CR or CRLF) after the word "one", I assume. Either remove this line
> break, or set appropriate flags for $file:
>
> $file->setFlags(
> SplFileObject::READ_AHEAD | SplFileObject::SKIP_EMPTY
> );

Thanks Christoph! That worked. Now I know how to set the flags to get the behaviour I need.
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: Putting it all together
Next Topic: encoding
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Thu May 09 21:19:08 GMT 2024

Total time taken to generate the page: 0.05002 seconds