Re: Feature request: anonymous usage of returned values
| From: | Andi Gutmans | Date: | Sat, 20 Apr 2002 12:49:35 +0000 |
| Subject: | Re: Feature request: anonymous usage of returned values | ||
| References: | 1 2 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-83054@lists.php.net to get a copy of this message | ||
This isn't planned for Engine 2 but you could use:
list(,,,,$year) = localtime($time);
Andi
At 03:17 20/04/2002 +0200, Markus Fischer wrote:
I've brought this up on the Zend Engine2 list a while ago. The result was that it is not planned to support dereferencing of arrays from e.g. return value on the fly.- MarkusOn Fri, Apr 19, 2002 at 07:26:26PM -0500, Derek Moore wrote : I've been playin' around with Horde and IMP lately... And I've done a lot of PHP and Perl work in the past... One of the things I really like about PHP is how it has most of the really cool features of Perl that I enjoy, but lacks some of the things that annoy me about Perl. I was making some modifications to IMP's configurations when I tried to use a feature of Perl that I thought for sure would have been carried over to PHP. I'm not sure the exact vernacular to describe this feature, but Perl allows you to anonymously use whatever was returned by a function--e.g., $year = (localtime($time))[5], so $year takes only the year value of the data returned by localtime() instead of the entire array. In IMP I was trying to do: $conf['spam']['email'] = 'postmaster@' . (posix_uname())['nodename']; But instead I have to do: $uname = posix_uname(); $conf['spam']['email'] = 'postmaster@' . $uname['nodename']; I realize this is nitpicking a little bit, but being able to handle returned values in such a manner is quite, quite useful. Or does PHP provide this functionality through some other syntax? Anyways, I just thought I'd say somethin' about it. Btw, please reply-to-all, as I'm not subscribed to this list. Okay, I'm done now, Derek [ derek p. moore ]-------------------[ http://hackunix.org/~derekm/pubkey.asc ] [ derekm@hackunix.org ]----------------------------[ bfd2 fad6 1014 80c9 aaa8 ] [ http://hackunix.org/~derekm/ ]-------------------[ a4a0 f449 3461 a443 51b9 ] -- PHP Development Mailing List <http://www.php.net/> To unsubscribe, visit: http://www.php.net/unsub.php -- Please always Cc to me when replying to me on the lists. GnuPG Key: http://guru.josefine.at/~mfischer/C2272BD0.asc "Mind if I MFH ?" "What QA did you do on it?" "the usual?" "ah... none :)" -- PHP Development Mailing List <http://www.php.net/> To unsubscribe, visit: http://www.php.net/unsub.php