You are here: Re: [PHP] split()? « PHP « IT news, forums, messages
Re: [PHP] split()?

Posted by "Mark Cain" on 06/15/05 05:02

Here is one way to do it:

$rr="thisscritjajsj[ OUT1 ]ajdamsda;sjo;tkpdk[ OUT2 ]sdfmjs[ OUT3 ]dfjlsd";

preg_match("/.*\[(.*)\].*\[(.*)\].*\[(.*)\].*/", $rr, $match);

list($whole_match[],$a[],$a[],$a[]) = $match;

print "<pre>";
print_r ($a);
print "</pre>";

exit;


Mark Cain

----- Original Message -----
From: <pineriver@vmist.net>
To: <php-general@lists.php.net>
Sent: Tuesday, June 14, 2005 8:13 PM
Subject: [PHP] split()?


> How would I do this ?
>
> Take this string and return everything between [ ] as an array output
doesnt
> have to inlude [ ]
> $rr="thisscritjajsj[ OUT1 ]ajdamsda;sjo;tkpdk[ OUT2 ]sdfmjs[
OUT3 ]dfjlsd";
>
> $a = some function
>
> echo '<pre>';
> print_r($a);
>
> [0] => [ OUT1 ]
> [1] => [ OUT2 ]
> [2] => [ OUT3 ]
>
> Thanks
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация