ID:               50748
 Updated by:       [email protected]
 Reported By:      gahgneh+php at gmail dot com
-Status:           Open
+Status:           Bogus
 Bug Type:         Variables related
 Operating System: Windows XP SP3
 PHP Version:      5.2.12
 New Comment:

For passing references we would need to know at the time the parameters
are prepared, before actually invoking the function, that references are
expected. That can only be done by defining it in the signature ... but
when doing that func_get_args() is rather useless - the only case would
be an undefined number of reference parameters which can be simulated by
using an array of references as parameter ... but then again: There's
barely any reason for using references these days in PHP.


Previous Comments:
------------------------------------------------------------------------

[2010-01-14 11:00:04] gahgneh+php at gmail dot com

Description:
------------
func_get_args() should be able to pass variables as reference

Reproduce code:
---------------
function ref(){
  $args = func_get_args();
  $args[0] = 10;
  $args[1] = 11;
}

$value = 0;
$value2 = 1;
ref($value, $value2);

echo $value,$value2; // prints 01

Expected result:
----------------
$value to contain "int 10" and $value2 to contain "int 11"
There should be a * pointer operator like C++, to tell the variable to
behave like
function ref(int* p = null){ *p = 10; }



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


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

Reply via email to