FUDforum - خوراک RDF
http://fudforum.org/forum/index.php
grep in php?
http://fudforum.org/forum/index.phpindex.php?t=rview&goto=179408&th=122832#msg_179408
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.
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
--
I do not want life insurance.
I want all people to be genuinely grieving when I die.
houghi]]>houghi2012-10-20T10:04:34-00:00Re: grep in php?
http://fudforum.org/forum/index.phpindex.php?t=rview&goto=179409&th=122832#msg_179409
> 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.
>
> 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
> ]]>Luuk2012-10-20T10:30:16-00:00Re: grep in php?
http://fudforum.org/forum/index.phpindex.php?t=rview&goto=179410&th=122832#msg_179410
> 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
OK, thanks for the pointer.
houghi
--
I do not want life insurance.
I want all people to be genuinely grieving when I die.