|
Posted by Janwillem Borleffs on 04/01/07 10:31
Curtis wrote:
> I have been trying to toy around with the func_get_args function,
> however, it seems the data is copied before I can access it, as I
> tried to globalize the values in the argument array and use
> references, but neither worked.
>
As a workaround, you can pass the function a single array or object by
reference:
function modify(&$object) {
$object->a = strtoupper($object->a);
}
$object = new stdClass;
$object->a = 'a';
modify($object);
print $object->a; // A
Note that when passing an object, it's passed by reference by default in PHP
5.
JW
Navigation:
[Reply to this message]
|