ID: 15599
Updated by: [EMAIL PROTECTED]
Reported By: [EMAIL PROTECTED]
Status: Open
Bug Type: Feature/Change Request
Operating System: all
PHP Version: 4.1.1
New Comment:
don't think so
example:
$var = "a"; // var $c->b
$ref = &$var; // function $c->fc();
and how do u think about:
$a = $ref; // $myvar = $c->fc();
and
$b = &$ref; // $myvar = $c->fc();
which is copy and which is reference?
$a or $b?
Previous Comments:
------------------------------------------------------------------------
[2002-02-18 10:33:14] [EMAIL PROTECTED]
I think it is a bit funny that when returning references from functions
you get something looking kind of this in the end:
$a = & & $b;
That is, I think it would be more logic if a function that is specified
to return a reference wouldn't need to be set on the return side to
return a reference.. since I doesn't make my self clear, here is as an
example what I mean:
class a {
var $b;
function &fc() {
return $this->b;
}
}
$c = new a();
// A)
$myvar = $c->fc();
-----------------------------------
Now this will not work as I seem would be logical, instead one need to
do the last line:
// B)
$myvar = &$c->fc();
This seems funny.. My logic says that since the function is defined to
return a reference it would be enough (A).. no need to do it again like
in (B). This is true when passing a reference: somefunc($myvar) will
result in passing an reference if the func is defined like
function somefunc(&$arg)
Is there any chance of a change?
Opinions, comments etc. ?
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=15599&edit=1