RE: [PHP] split
| From: | Don Read | Date: | Thu, 27 Mar 2003 21:25:28 +0000 |
| Subject: | RE: [PHP] split | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-141317@lists.php.net to get a copy of this message | ||
On 27-Mar-2003 Oden Odenius wrote:
> I have $word = "test";
> And i want to split it like
> t
> e
> s
> t
>
> I want to make a loop.Like $a = "123"; //$a is One two threw not
> hundred...
> and i want to make for each $a then $b = $a + 2
>
> The output will be.
> 3 (1+2)
> 4 (2+2)
> 5 (3+2)
>
> Any example?
>
$str='test';
$ary=preg_split('//', $str, -1, PREG_SPLIT_NO_EMPTY);
echo implode("<br>\n", $ary), '<P>';
$ary=preg_split('//', '123', -1, PREG_SPLIT_NO_EMPTY);
foreach($ary as $a) {
$b= $a + 2;
echo "<br>", $b, " ($a + 2)";
}
> Btw sorry for my english
>
>
>
> --
> Programmers are tools for convert coffeine into code... (c) Oden
>
>
>
>
> _________________________________________________________________
> MSN 8 with e-mail virus protection service: 2 months FREE*
> http://join.msn.com/?page=features/virus
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
--
Don Read dread@texas.net
-- It's always darkest before the dawn. So if you are going to
steal the neighbor's newspaper, that's the time to do it.
(53kr33t w0rdz: sql table query)