Re: Re: spliting the elements in array
| From: | Stut | Date: | Wed, 04 Jul 2007 10:03:21 +0000 |
| Subject: | Re: Re: spliting the elements in array | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-258232@lists.php.net to get a copy of this message | ||
sivasakthi wrote:
Thanks for your response.. Actually i have the collections of strings like, $not_quite_an_array = 'squid %tu %tl %mt %>A test %st.%hs %>a %<m %tu %th %Hs %Ss test1 %tv %tr %Hs.%Ss %mt'; from that i need to split name of each line..$names = array(); foreach (explode("\n", $not_quite_an_array) as $line) {
$line = trim($line);
if (strlen($line) == 0) continue;
$names[] = array_shift(explode(' ', $line, 2));
}
-Stut
--
http://stut.net/