RE: [PHP] Syntax ::: does explode('-', $string)[2] ::: have a twi n brother?

From: Date: Tue, 19 Dec 2000 03:35:04 +0000
Subject: RE: [PHP] Syntax ::: does explode('-', $string)[2] ::: have a twi n brother?
Groups: php.general 
Request: Send a blank email to php-general+get-30984@lists.php.net to get a copy of this message
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 > <http://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

« previous php.general (#30984) next »