|
Posted by Curtis on 04/01/07 20:52
Janwillem Borleffs wrote:
> 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
>
>
Ahh, thank you, I like your approach. Not sure why my mind was set on
varargs.
Thanks for the help,
Curtis, http://dyersweb.com
[Back to original message]
|