From: matt at matttoddphoto dot com Operating system: Any PHP version: 6CVS-2006-01-10 (snap) PHP Bug Type: Feature/Change Request Bug description: Array literal syntax support
Description: ------------ It would be lovely to be able to literally define arrays with simple syntax like the following: ["one", "two", "three"] instead of the less intuitive: array("one", "two", "three"); This would simplify creating arrays of arrays (of arrays) inline for functions. Also, this would help solve the 'named parameters' request by allowing for an associative array to be given simply by throwing []s in. Reproduce code: --------------- Here is an example just for the sake of clarity: $validate = [$_POST['post'], ['title'=>'/[A-Za-z0-9_\?\!\.\#\&\%]+/', "text"=>'/\w*/', 'user_id'=>'/\d+/']]; This would be in opposition to: $validate = array($_POST['post'], array('title'=>'/[A-Za-z0-9_\?\!\.\#\&\%]+/', "text"=>'/.*/', 'user_id'=>'/\d+/')); You can see how more complex examples can get just that much more complex (the the nth degree). -- Edit bug report at http://bugs.php.net/?id=35957&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=35957&r=trysnapshot44 Try a CVS snapshot (PHP 5.1): http://bugs.php.net/fix.php?id=35957&r=trysnapshot51 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=35957&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=35957&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=35957&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=35957&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=35957&r=needscript Try newer version: http://bugs.php.net/fix.php?id=35957&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=35957&r=support Expected behavior: http://bugs.php.net/fix.php?id=35957&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=35957&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=35957&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=35957&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=35957&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=35957&r=dst IIS Stability: http://bugs.php.net/fix.php?id=35957&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=35957&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=35957&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=35957&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=35957&r=mysqlcfg