Re: Bug #11063 Updated: $var = function_returning_array(args)[0]; doesn't work
| From: | Daniel Beckham | Date: | Wed, 23 May 2001 21:37:51 +0000 |
| Subject: | Re: Bug #11063 Updated: $var = function_returning_array(args)[0]; doesn't work | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-56544@lists.php.net to get a copy of this message | ||
This syntax comes from using slices in Perl. It's a great feature, but as
you say, unlikely to see the light of day in PHP.
e.g. my ($user, $uid, $gid) = split(/:/, $line_from_passwd_file)[0,2,3];
Great feature. =)
Daniel
----- Original Message -----
From: <derick@php.net>
To: <php-dev@lists.php.net>
Sent: Wednesday, May 23, 2001 4:33 PM
Subject: [PHP-DEV] Bug #11063 Updated: $var =
function_returning_array(args)[0]; doesn't work
> ID: 11063
> Updated by: derick
> Reported By: jeremy@deadbeef.com
> Old-Status: Open
> Status: Suspended
> Old-Bug Type: Scripting Engine problem
> Bug Type: Feature/Change Request
> Operating system:
> PHP Version: 4.0.4pl1
> Assigned To:
> Comments:
>
> This syntax does not make sense at all (to me). It is not present in any
language AFAIK.
> A function simply returns an array, and if you want to do something with
that, do it later.
>
> However, it is a valid feature request, but I don't think it wil be
implemented in short time.
> Changed type to Feature Request and status to Suspended.
>
> Derick
>
> Previous Comments:
> --------------------------------------------------------------------------
-
>
> [2001-05-23 16:35:48] jeremy@deadbeef.com
> $var = function_returning_array(args)[0];
>
> gives an error but
>
> $var = function_returning_array(args);
> $var=$var[0];
>
> works fine. I think that either should work.
>
> --------------------------------------------------------------------------
-
>
>
>
> ATTENTION! Do NOT reply to this email!
> To reply, use the web interface found at
http://bugs.php.net/?id=11063&edit=2
>
>
> --
> PHP Development Mailing List <http://www.php.net/>
> To unsubscribe, e-mail: php-dev-unsubscribe@lists.php.net
> For additional commands, e-mail: php-dev-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>
>