Re: Can php give me row number?
| From: | Stephan Ahonen | Date: | Sun, 06 May 2001 17:53:09 +0000 |
| Subject: | Re: Can php give me row number? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-51642@lists.php.net to get a copy of this message | ||
> Now I also wan´t to know to in which row the word was found.
> Is there a simple way to add some code?
You could explode the file into an array with "\r\n" as the delimiter before
you do the search, then iterate through the resulting array to look for the
word, then the array index you find the word in is the line number.
To save a couple lines of code, use the file() function, it returns the
contents conveniently pre-split into the array.
Sig for a Day
Stephan Ahonen, ICQ 491101
"That's very funny Scotty, now beam down my clothes!"
Come back tomorrow for a different sig!
Backspace a single "s" to reply by email