Reply to Re: remove all lines starting with b

Your name:

Reply:


Posted by David Haynes on 10/21/10 11:43

d wrote:
> "Rex" <eric.fiori@gmail.com> wrote in message
> news:1143445129.437173.181710@t31g2000cwb.googlegroups.com...
>> I believe you want to read the file line by line and then try and match
>> your regex to each line. try:
>>
>> $handle = @fopen("dummy.txt", "r");
>> if ($handle) {
>> while (!feof($handle)) {
>> $buffer = fgets($handle);
>> if( !preg_match('/^b.*?\n/',$buffer) )
>> echo $buffer . "<br>";
>> }
>> fclose($handle);
>> }
>
> You could use substr($buffer, 0, 1)=="b" as opposed to preg_match, as
> preg_match is a bit more intensive than just substr...
>
>
or just $buffer[0]...

-david-

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация