Re: [RFC] new foo()->bar()
| From: | Felipe Pena | Date: | Tue, 30 Nov 2010 01:15:10 +0000 |
| Subject: | Re: [RFC] new foo()->bar() | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-50709@lists.php.net to get a copy of this message | ||
2010/11/29 Felipe Pena <felipensp@gmail.com>
> It also probably makes sense to add array deference chaining e.g. new
>> Foo()[] (just for language consistency).
>>
>>
> Hmm, looks good to me. :)
>
>
I've updated the patch with the bracketed version to include the array
dereferecing support:
http://felipe.ath.cx/diff/instance-method-call-3.patch
<?php
class foo extends ArrayObject {
public function __construct($arr) {
parent::__construct($arr);
}
}
$arr = array(1, 2, 3);
$value = (new foo($arr))[1]; // int(2)
?>
Some tests: http://felipe.ath.cx/diff/instance_direct_access_001.phpt
--
Regards,
Felipe Pena