Re: Syntax ::: does explode('-', $string)[2] ::: have a twi n brother?
| From: | Josh G | Date: | Tue, 19 Dec 2000 05:10:38 +0000 |
| Subject: | Re: Syntax ::: does explode('-', $string)[2] ::: have a twi n brother? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-30991@lists.php.net to get a copy of this message | ||
Methinks it just can't be done.
Gfunk
My name was Brian McGee,
I stayed up listening to Queen,
When I was seventeen.
http://www.gfunk007.com/
----- Original Message -----
From: "Maxim Maletsky" <maxim.maletsky@japaninc.net>
To: "'Philip Olson'" <philip@theprojects.org>
Cc: "'Josh G'" <josh@gfunk007.com>; "PHP User Group"
<php-general@lists.php.net>
Sent: Tuesday, December 19, 2000 4:06 PM
Subject: RE: [PHP] Syntax ::: does explode('-', $string)[2] ::: have a twi n
brother?
> Thanks for your understanding.
>
> and, you're right : it did not answer my question. But you gave me a good
> idea. I wasn't about to do that, I though I would have some guru replying
me
> with some very "scary" line which would be what I asked for, but, what the
> hell.. I'll just put that function in my library and that's it.
>
> Hope someday I'll find the answer...
>
> Thanks to everyone!
>
> Maxim Maletsky.
>
> -----Original Message-----
> From: Philip Olson [mailto:philip@theprojects.org]
> Sent: Tuesday, December 19, 2000 1:36 PM
> To: Maxim Maletsky
> Cc: 'Josh G'; PHP User Group
> Subject: RE: [PHP] Syntax ::: does explode('-', $string)[2] ::: have a
> twi n brother?
>
>
> Hey Maxim-
>
> This does not answer your question and is fairly obvious/straight forward
> BUT I am very bored :-)
>
> $string = '2000-05-12';
>
> function oExplode($sep,$string,$o=0)
> {
> $tmp = explode("$sep",$string);
> Return $tmp[$o];
> }
>
> print oExplode('-',$string,2);
>
> In otherwords, my reply is : "Create your own function!" It's good to be
> curious, I tend to ask such questions and people often reply "just do
> this" and miss the point ... Anyway, later.
>
> Regards,
>
> Philip
>
>
> --.sig
> [ Want to write Good code? First, write Bad code. ]
>
> On Tue, 19 Dec 2000, Maxim Maletsky wrote:
>
> > Nope, tried it already...
> >
> >
> >
> > -----Original Message-----
> > From: Josh G [mailto:josh@gfunk007.com]
> > Sent: Tuesday, December 19, 2000 12:31 PM
> > To: Maxim Maletsky; PHP User Group
> > Subject: Re: [PHP] Syntax ::: does explode('-', $string)[2] ::: have a
> > twin brother?
> >
> >
> > Hmmmm, have you tried:
> >
> > $to = (explode('-', $string))[2];
> >
> > I don't know if it would work, but if it's possible,
> > that's the way I'd do it. I doubt it's possible tho, as
> > PHP doesn't have the strongest / most correct
> > parser out there.
> >
> > Gfunk
> >
> > My name was Brian McGee,
> > I stayed up listening to Queen,
> > When I was seventeen.
> >
> > http://www.gfunk007.com/
> >
> >
> > ----- Original Message -----
> > From: "Maxim Maletsky" <maxim.maletsky@japaninc.net>
> > To: "'PHP General List. (E-mail)'" <php-general@lists.php.net>
> > Sent: Tuesday, December 19, 2000 2:26 PM
> > Subject: [PHP] Syntax ::: does explode('-', $string)[2] ::: have a twin
> > brother?
> >
> >
> > > Did I see it somewhere or I dreamed it off my tired mind?
> > >
> > > I was wondering if there is a way to say this:
> > >
> > > $to = explode('-', $string);
> > > $to = $to[2];
> > >
> > > somehow like this:
> > >
> > > $to = explode('-', $string)[2];
> > >
> > > Here's my test page:
> > >
> > > $string = '2000-05-12';
> > >
> > > $to = explode('-', $string);
> > > $to = $to[2];
> > > echo " $string ::: $to ";
> > >
> > > unset ($to); echo '<P>';
> > >
> > > $to = explode('-', $string)[2];
> > > echo " $string ::: $to ";
> > >
> > > And, of course, it doesn't work ...
> > >
> > > I am asking it because I though that I've seen it somewhere before, I
> > > basically don't need an array at all, yet I would like to keep the
> > variable
> > > called $to. I am sure that the key [2] is what I need. I could even
use
> > > substring() but my curiosity doesn't let me to.
> > >
> > > I want to know if there's a way to assign an array key to a function
> which
> > > that produce an array.
> > >
> > > Just syntax staff..
> > >
> > > Cheers.
> > > Maxim Maletsky.
> > >
> > > Maxim Maletsky - maxim@j-door.com
> > > <mailto:maxim@j-door.com>
> > > Webmaster, J-Door.com / J@pan Inc.
> > > LINC Media, Inc.
> > > TEL: 03-3499-2175 x 1271
> > > FAX: 03-3499-3109
> > >
> > > http://www.j-door.com
> > > <http://www.j-door.com/>
> > > http://www.japaninc.net <2
> > >
ÛäzDm½# ÓUžvThttp://www.japaninc.net/>
> > > http://www.lincmedia.co.jp
> > > <http://www.lincmedia.co.jp/>
> > >
> > >
> > >
> > >
> > >
> >
> >
> >
> --------------------------------------------------------------------------
--
> > ----
> >
> >
> > > --
> > > PHP General Mailing List (http://www.php.net/)
> > > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> > > For additional commands, e-mail: php-general-help@lists.php.net
> > > To contact the list administrators, e-mail:
php-list-admin@lists.php.net
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> > For additional commands, e-mail: php-general-help@lists.php.net
> > To contact the list administrators, e-mail: php-list-admin@lists.php.net
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> > For additional commands, e-mail: php-general-help@lists.php.net
> > To contact the list administrators, e-mail: php-list-admin@lists.php.net
> >
>