rfc:bare_name_array_literal
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
rfc:bare_name_array_literal [2014/06/21 19:39] – Vote name change ajf | rfc:bare_name_array_literal [2017/09/22 13:28] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 3: | Line 3: | ||
* Date: 2014-06-01 | * Date: 2014-06-01 | ||
* Author: Andrea Faulds < | * Author: Andrea Faulds < | ||
- | * Status: | + | * Status: |
* First Published at: http:// | * First Published at: http:// | ||
Line 71: | Line 71: | ||
Symmetry between arrays and named parameters would be desirable as otherwise it could cause confusion. This RFC would ensure it. | Symmetry between arrays and named parameters would be desirable as otherwise it could cause confusion. This RFC would ensure it. | ||
- | This also complements the [[rfc: | + | Even without named parameters, this makes it nicer to use functions which take an array of options. For example: |
+ | |||
+ | <code php> | ||
+ | $ctx = stream_context_create([http: | ||
+ | |||
+ | // or | ||
+ | |||
+ | $hash = password_hash($_POST[' | ||
+ | </ | ||
+ | |||
+ | This makes creating JSON more convenient, too: | ||
+ | |||
+ | <code php> | ||
+ | // Real example | ||
+ | $ws-> | ||
+ | type: ' | ||
+ | room: $player-> | ||
+ | nick: $player-> | ||
+ | x: 0, | ||
+ | y: 0, | ||
+ | avatar: ' | ||
+ | ])); | ||
+ | </ | ||
+ | |||
+ | This complements the [[rfc: | ||
===== Proposal ===== | ===== Proposal ===== | ||
Line 95: | Line 119: | ||
<code php> | <code php> | ||
- | const('foo', | + | const foo = ' |
$arr = [foo: 3]; | $arr = [foo: 3]; | ||
// array(1) { | // array(1) { | ||
Line 140: | Line 164: | ||
===== Vote ===== | ===== Vote ===== | ||
- | A 2/3 majority as it is a language change. Voting began on 2014-06-20 and ends 2014-06-27. | + | A 2/3 majority as it is a language change. Voting began on 2014-06-21 (after a hiccup it was restarted) |
- | <doodle title=" | + | <doodle title=" |
* Yes | * Yes | ||
* No | * No |
rfc/bare_name_array_literal.txt · Last modified: 2017/09/22 13:28 by 127.0.0.1