PhpRiot

Listing 1756

Followup to listing-1755.php, submitted by PHPRO.ORG.

Submitted by anonymous user, 14 November 2008
<?php
 
        $file = 'foo.txt';
 
        $text = 'foo';
 
        function getNextLine($text, $file)
        {
                $lines = file($file);
                while(current($lines))
                {
                        if(strpos(current($lines), $text))
                        {
                                return next($lines);
                        }
                        next($lines);
                }
                return false;
        }
 
        echo getNextLine($text, $file);
Submit a Follow Up