Edit report at https://bugs.php.net/bug.php?id=61881&edit=1

 ID:                 61881
 Updated by:         fel...@php.net
 Reported by:        semias at web dot de
 Summary:            Dereferencing in returning References
-Status:             Open
+Status:             Not a bug
 Type:               Feature/Change Request
 Package:            *General Issues
 PHP Version:        5.4.1
 Block user comment: N
 Private report:     N

 New Comment:

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

Does not exists shortcut for such.


Previous Comments:
------------------------------------------------------------------------
[2012-04-30 16:20:33] semias at web dot de

Description:
------------
As in Example #8 Array dereferencing 
(http://docs.php.net/manual/en/language.types.array.php)
// As of PHP 5.4 it is possible to array dereference the result of a function 
or method call directly. Before it was only possible using a temporary 
variable. 

$secondElement = getArray()[1];

I would expect same in Returning References:

class foo {
    public $value = 42;
    public function &getValue() {
        return $this->value;
    }
}

&$foo->getValue() = 'new value';

instead of ...

$v = &$foo->getValue();
$v = 'bla';

Or does any syntax to do it directly already exists?

:) Thank You

Test script:
---------------
none



------------------------------------------------------------------------



-- 
Edit this bug report at https://bugs.php.net/bug.php?id=61881&edit=1

Reply via email to