rfc:instance-method-call

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
rfc:instance-method-call [2010/11/27 20:26] – update feliperfc:instance-method-call [2011/04/06 10:59] – external edit 127.0.0.1
Line 21: Line 21:
   * %%(new $foo())->bar%%   * %%(new $foo())->bar%%
   * %%(new $bar->y)->x%%   * %%(new $bar->y)->x%%
 +  * %%(new foo)[0]%%
  
 ===== Examples ===== ===== Examples =====
  
 === Using brackets === === Using brackets ===
 +
 +<code php>
 +<?php
 +
 +class foo extends ArrayObject {
 + public function __construct($arr) {
 + parent::__construct($arr);
 + }
 +}
 +
 +var_dump( (new foo( array(1, array(4, 5), 3) ))[1][0] ); // int(4)
 +
 +?>
 +</code>
 +
 <code php> <code php>
 <?php <?php
Line 137: Line 153:
   * http://felipe.ath.cx/diff/instance-method-call.patch (without brackets)   * http://felipe.ath.cx/diff/instance-method-call.patch (without brackets)
   * http://felipe.ath.cx/diff/instance-method-call-2.patch (with brackets)   * http://felipe.ath.cx/diff/instance-method-call-2.patch (with brackets)
 +  * http://felipe.ath.cx/diff/instance-method-call-3.patch (with brackets + array dereferencing)
  
 ===== Changelog ===== ===== Changelog =====
Line 142: Line 159:
   * 26/11/2010 - Posted RFC on internals   * 26/11/2010 - Posted RFC on internals
   * 27/11/2010 - New syntax proposed   * 27/11/2010 - New syntax proposed
 +  * 29/11/2010 - Added array dereferencing support (e.g. %%(new foo)[0]%%)
rfc/instance-method-call.txt · Last modified: 2017/09/22 13:28 by 127.0.0.1