RE: [PHP] Syntax ::: does explode('-', $string)[2] ::: have a twi n brother?
| From: | Maxim Maletsky | Date: | Tue, 19 Dec 2000 06:19:07 +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-31000@lists.php.net to get a copy of this message | ||
Yeah .. this is sweet ...
haven't though 'bout it....
Thanks!
-----Original Message-----
From: Faisal Nasim [mailto:faisal@nasim.org]
Sent: Tuesday, December 19, 2000 3:15 PM
To: Maxim Maletsky; 'PHP General List. (E-mail)'
Subject: Re: [PHP] Syntax ::: does explode('-', $string)[2] ::: have a
twin brother?
At 12:26 PM 12/19/2000 +0900, Maxim Maletsky wrote:
>Did I see it somewhere or I dreamed it off my tired mind?
I use it in Perl all the time!
>
>I was wondering if there is a way to say this:
>
> $to = explode('-', $string);
> $to = $to[2];
Here's a different approach:
list ( $hell , $hell , $to ) = explode ( '-' , $string );
PHP could use something like Perl's versatile 'undef'
function/op.
Enjoy!
Faisal
--
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