Re: Explode Question
| From: | James Yerge | Date: | Wed, 18 May 2011 00:12:33 +0000 |
| Subject: | Re: Explode Question | ||
| References: | 1 2 3 4 5 6 7 8 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-312853@lists.php.net to get a copy of this message | ||
On 05/17/2011 07:53 PM, admin@buskirkgraphics.com wrote:
> The desired result is.
>
> Array
> (
> [0] = > "On the";
> [1] = > "course or in the";
> [2] = > "of colver";
> );
>
> I am just not sure the delimiter can be an array in the Explode function.
>
>
>
>
>
>
> Richard L. Buskirk
>
> -----Original Message-----
> From: Marc Guay [mailto:marc.guay@gmail.com]
> Sent: Tuesday, May 17, 2011 7:52 PM
> To: php-general@lists.php.net
> Subject: Re: [PHP] Explode Question
>
>> $one = array(0 =>'golf', 1 => 'field');
>> $two = array(0 => "On the golf course or in the field of clover");
>> $array_exp = explode($one, $two);
> What's the desired result?
>
> array('golf' => "On the golf course or in the field of clover",
> 'field' => "On the golf course or in the field of clover")); ?
>
>
> Marc
>
explode() takes three parameters; string, string, [int]. Where [int] is
optional.
Ex:
$ipList = '192.168.1.0,192.168.1.1,192.168.1.2';
$ipList = explode(',',$ipList);
Returns an array of strings:
Array
(
[0] => 192.168.1.0,
[1] => 192.168.1.1,
[2] => 192.168.1.2
);