|
Posted by Vince Morgan on 07/16/07 01:52
Sorry Rebecca. I should have looked more closely. The parameters for
'explode()' are reversed.
$ary = explode($string, ','); should be as below.
$ary = explode(',', $string);
My appologies,
Vince
<rebeccatre@gmail.com> wrote in message
news:1184550344.620682.189780@o61g2000hsh.googlegroups.com...
> On Jul 15, 8:29 pm, "Vince Morgan" <vinharAtHereoptusnet.com.au>
> wrote:
> > <?
> > $string='datagreen,datablue,dataetc';
> > $ary = explode($string, ',');
> > echo "<p>".$ary[2]."</p>\t";
> >
> > ?>
> > Should output:
> >
> > dataetc
> >
> > HTH
> > Vince<rebecca...@gmail.com> wrote in message
> >
> > news:1184548548.346329.169130@r34g2000hsd.googlegroups.com...
> >
> > > On Jul 15, 8:09 pm, Michael Fesser <neti...@gmx.de> wrote:
> > > > .oO(rebecca...@gmail.com)
> >
> > > > >Usually I get a answer in alt.php concerning MYSQL :-) :-)
> >
> > > > >I've reposted the question below, I have a very large and complex
> > > > >environment, and this is just the thing I need to do. Can someone
> > > > >please show a working example? How does the explode() command help
me
> > > > >pull back #5 data slot? Thank you for your patience and anyone can
> > > > >help that would be great.
> >
> > > > Did you actually read the manual page for explode()? Using it is
pretty
> > > > easy - you feed a string to it and get an array back. The 5th
element of
> > > > your string would be the 4th element in the array (zero-based
indexes).
> >
> > > > Micha
> >
> > > Thank you Micha & Vince, this is kinda the theory that I hope to
> > > figure out. I do understand there is a explode command, but there
> > > isn't sufficient examples out there (or at least I have not found one
> > > yet) related to answer what I would like.
> >
> > > The code example kindly posted by Vince is helpful to understand-see
> > > the explode() command unravel the string, but it doesn't solve the
> > > question I proposed. :( I want to be able to only print part of that
> > > string on demand (5th slot for example).... am I getting close? ;)
>
> Vince, maybe I missed something in running this, but I actually got a
> empty return :(
>
[Back to original message]
|