Re: ereg
| From: | Kevin Beckford | Date: | Tue, 20 Jun 2000 14:16:01 +0000 |
| Subject: | Re: ereg | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-2303@lists.php.net to get a copy of this message | ||
> Hi,
>
> I am trying to use ereg to see if there is already an entry in the
> httpd.conf. I tried to load the file into an array and use count in
> conjunction with a for loop to ereg every line. That didn't work the file
> is huge and the execution time fluked out. anyone know a good way to check
> if there is an existing entry in a file. Say I want to see if domain.com
> is already in the file? I imagine you would use ereg but I can't seem to
> figure out a way to plow through an entire file and find it?
2 choices (off the top of my head):
Use preg_match - it's faster than ereg
system("grep 'entry' httpd.conf",$result_array)
This will fill each line of $result_array with the lines that contain
the 'entry'