Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.php > #7342
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!eternal-september.org!feeder.eternal-september.org!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Date | Sat, 20 Oct 2012 12:30:16 +0200 |
| From | Luuk <luuk@invalid.lan> |
| User-Agent | Mozilla/5.0 (Windows NT 6.1; WOW64; rv:16.0) Gecko/20121010 Thunderbird/16.0.1 |
| MIME-Version | 1.0 |
| Newsgroups | comp.lang.php |
| Subject | Re: grep in php? |
| References | <slrnk84tpi.3ht.houghi@penne.houghi> |
| In-Reply-To | <slrnk84tpi.3ht.houghi@penne.houghi> |
| Content-Type | text/plain; charset=ISO-8859-1; format=flowed |
| Content-Transfer-Encoding | 7bit |
| Message-ID | <i2bal9-2q8.ln1@luuk.invalid.lan> (permalink) |
| Lines | 21 |
| NNTP-Posting-Host | 2001:980:9089:1:3545:d87a:d776:4b20 |
| X-Trace | 1350729602 news.xs4all.nl 6848 [2001:980:9089:1:3545:d87a:d776:4b20]:53405 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.php:7342 |
Show key headers only | View raw
On 20-10-2012 12:04, houghi wrote:
> I am looking how to do a grep in php. I have a variable(1) with very much
> random data.
>
> I want only to get lines that have certain words in it. As far as I can
> see preg_grep does not work, as the data isn't an array.
>
read the file contents into an array:
http://www.php.net/manual/en/function.file.php
> I could use (exec grep ...), but I rather not.
>
> I am looking for something that does:
> $result = grep("word_I_look_for",$result);
>
> (1)If it is easier, I can use a file instead of a variable.
>
> houghi
>
Back to comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
grep in php? houghi <houghi@houghi.org.invalid> - 2012-10-20 12:04 +0200
Re: grep in php? Luuk <luuk@invalid.lan> - 2012-10-20 12:30 +0200
Re: grep in php? houghi <houghi@houghi.org.invalid> - 2012-10-20 15:07 +0200
csiph-web