Posted by Charlie King on 01/14/06 22:55
On 14 Jan 2006 12:39:27 -0800, in
<1137271167.529986.168260@g14g2000cwa.googlegroups.com>
(comp.lang.php) "zek2005" <esapoznik@gmail.com> wrote:
> Hi friends!
>
> I have a varchar field in my DB with numeric values separates by
> spaces. I need to extract the numbers to create an array.
>
> Example 1: 1820 1823 1825 --> need to be transform into
>
> 1820
> 1823
> 1825
>
> Example 2: 1 5 21 31 <<> must be transform into
> 1
> 5
> 21
> 31
>
> The difference between ex 1 and 2 is that there might be different
> length between numbers.
>
> Can anyone help me???
$myArray = explode(" ", $myString)
explode() splits up the string in its second argument at each
ocurrence of the string in its first argument, and returns the results
into an array.
The manual http://fr.php.net/manual/en/function.explode.php
gives good examples.
Cheers
--
Charlie
Navigation:
[Reply to this message]
|