You are here: Re: Grabbing Arbitrary Amount of Function Arguments by Reference « PHP Programming Language « IT news, forums, messages
Re: Grabbing Arbitrary Amount of Function Arguments by Reference

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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация