Re: [RFC] Bare Name Array
| From: | Rowan Collins | Date: | Sun, 01 Jun 2014 19:47:48 +0000 |
| Subject: | Re: [RFC] Bare Name Array | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-74680@lists.php.net to get a copy of this message | ||
On 01/06/2014 18:59, Andrea Faulds wrote:
The first is a less cumbersome syntax for arrays. At present, string keys in arrays are declared like this: “stringKey” => 3, [...] Where the key fits the profile of IS_STRING, this RFC proposes that you can do this instead: stringKey: 3,Interestingly, I notice Ruby's hash syntax has two variants very similar to this [http://www.ruby-doc.org/core-2.1.2/Hash.html]. However, in that case, the unquoted version represents a use of Ruby's special "Symbol" type, which is actually a different fundamental type from a String. So the following actually defines a 2-element hash, with one Symbol key and one String key: foo = { myKey: 'bar', 'myKey' => 'bob' } => {:myKey=>"bar", "myKey"=>"bob"} -- Rowan Collins [IMSoP]