On Sun, Dec 27, 2015 at 03:20:40PM -0800, Stanislav Malyshev wrote:
> Hi!
> 
> > // With the new array syntax this has been improved to
> >  
> > list ($a, $b) = [1, 2];
> >  
> > // I think this new syntax should logically extend to
> >  
> > [$a, $b] = [1, 2];
> 
> list() and array() are two different language constructs, using the same
> syntax for them is a bad idea.

What he wrote looks very perl-ish, but with [] instead of ().

The perl ideom to swap the values of 2 variables:

($b, $a) = ($a, $b);

could be written in PHP as:

[$b, $a] = [$a, $b];

Looked at that way (left hand of '=' only) it is not that bad.

-- 
Alain Williams
Linux/GNU Consultant - Mail systems, Web sites, Networking, Programmer, IT 
Lecturer.
+44 (0) 787 668 0256  http://www.phcomp.co.uk/
Parliament Hill Computers Ltd. Registration Information: 
http://www.phcomp.co.uk/contact.php
#include <std_disclaimer.h>

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to