|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2006-01-10 08:36 UTC] derick@php.net
[2011-11-27 01:08 UTC] rasmus at mindplay dot dk
[2011-11-27 12:31 UTC] felipe@php.net
-Status: Wont fix
+Status: Closed
-Package: Feature/Change Request
+Package: *General Issues
-Assigned To:
+Assigned To: felipe
[2013-03-04 20:39 UTC] don at dongilbert dot net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Nov 05 11:00:02 2025 UTC |
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).