Re: Finding the Middle elements of a String

From: Date: Sun, 11 May 2014 20:19:57 +0000
Subject: Re: Finding the Middle elements of a String
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-323282@lists.php.net to get a copy of this message
On May 11, 2014, at 11:12 AM, Ken Robinson <kenrbnsn@rbnsn.com> wrote: > What are you really looking to do? If you're looking to get the words out of the string, > just explode it into an array and get the elements you want from the array. > > $str = "apple,cherry,peach,pear"; > $ary = explode(',',$str); > > Ken THANKS EVERYBODY - SUPER HELPFUL! Yes I wanted to be able to pull out various elements as listed below - so this works great <?php $str = "apple,cherry,peach,pear"; $ary = explode(',',$str); // use for various needs... echo $ary[0].' - ' .$ary[1].' - ' .$ary[2].' - ' .$ary[3].' - ' ..$ary[4]; ?> -- Thanks, Dave - DealTek dealtek@gmail.com [db-14]

« previous php.general (#323282) next »