Re: preg_match_all

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

first: wrong list...

for example you have the output in an array called $lines...
then the code should be:

for ($i=0; $i < count($lines); $i++) {

   list ($field, $value) = split(":", $lines[$i]);
   $field = str_replace("<br>", "", $field);
   ${"$field"} = trim($value);

}


regards...

Tibor


PS: you should use associative array for this i think, thanks ease to handle

----- Original Message -----
From: "Lars Rasmussen" <bailey@sprit.dk>
To: <php-db@lists.php.net>
Sent: Tuesday, March 04, 2003 5:22 PM
Subject:  preg_match_all


> Hi All,
>
> Well i need a little help as allways.
> Lets say that i have this output:
> --------------------------------------
> <br>field1: value1
>
> <br>field2: value2
>
> <br>somefield: somevalue
>
> --------------------------------------
> I want the value in between <br> and this ": " and the value between ":
> " and \n
> So that i could do whis:
> print("$field1<br>");
> print("$field2<br>");
> print("$somefield");
> Souch that this would give this output:
> value1
> value2
> Somevalue
>
> Thanks a lot........
> Lars Rasmussen.
>
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux