News for hackers. Stuff that matters.
Re:Short array syntax finally in PHP 5.4 by whiskers on Sunday July 24, 2011 @10:30AM (#2799436)
It's not quite what you're asking for, but there is a way to handle array results from functions where you know the number of elements that will be returned.

For example:

// explode splits the string on the provided boundary

// and returns an array containing each segment.

// using list() we can assign the two segments to two

// variables within the same statement

$size = "1000x1000";

list( $width, $height ) = explode( "x", $size );

Re:Short array syntax finally in PHP 5.4 by andrewvc on Sunday July 24, 2011 @10:40AM (#2799458)
Ah yes, I love nothing more than functions on the left side of assignment.

Edit: Yes, it is a special form, but its still irregular, and that makes it shitty.

Re:Short array syntax finally in PHP 5.4 by abarrett on Sunday July 24, 2011 @10:48AM (#2799472)
http://www.php.net/manual/en/function.list.php

It's a language construct, not a function.

Re:Short array syntax finally in PHP 5.4 by wvenable on Sunday July 24, 2011 @12:43PM (#2799718)
It's a pretty common feature of a lot of languages (Python, Perl, etc) so it's really not that irregular.
Re:Short array syntax finally in PHP 5.4 by jrockway on Sunday July 24, 2011 @07:16PM (#2800621)
It looks more obviously "language feature" in Perl, Python, and JavaScript, though:

   my ($foo, $bar) = f;
   (foo, bar)      = f()
   var [foo, bar]  = f();
Re:Short array syntax finally in PHP 5.4 by wvenable on Sunday July 24, 2011 @08:19PM (#2800762)
How are any of those examples significantly different from:

   list($foo, $bar) = f();
Given that PHP uses the array() keyword for constructing arrays, it is perfectly symmetrical. My IDE highlights the list() keyword just the same as all the other keywords.
Re:Short array syntax finally in PHP 5.4 by masklinn on Sunday July 24, 2011 @11:25AM (#2799540)
`list` is a special form, not a function.