Re: Get fields values from a string.
| From: | Cristian Lavaque | Date: | Sat, 11 Oct 2003 01:26:45 +0000 |
| Subject: | Re: Get fields values from a string. | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-165818@lists.php.net to get a copy of this message | ||
err... sorry, the second line should be
$array = explode(':', $string);
Cristian
Cristian Lavaque wrote:
> yup
>
> you could do something like this
>
> $string = 'field_value1:field_value2:field_value3';
> $array = explode(':', $str);
> foreach($array as $substring){
> list($field, $value) = explode('_', $substr);
> $$field = $value;
> }
>
> hope this helps
>
> Cristian