|
Posted by Vince Morgan on 07/16/07 01:29
<?
$string='datagreen,datablue,dataetc';
$ary = explode($string, ',');
echo "<p>".$ary[2]."</p>\t";
?>
Should output:
dataetc
HTH
Vince
<rebeccatre@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? ;)
>
Navigation:
[Reply to this message]
|