Chris Jenkinson wrote:
Jochem Maas wrote:
although I wonder whether you shouldn't be re-evaluating what it is
your trying to do because I get the impression it's a whole load of work
for probably little payoff (consider that using alot of indirection in
your
code will make it harder to understand/read and therefore harder to
debug/maintain).
why not consider the possibility that all these 'by reference' args
could be items
in a single 'by reference' array?
Yes, that would be possible, however that would involve an API change -
as now functions would have to get their variables out of an array
rather than just a normal variable defined in the function. At the
extract() and compact() would be your friends.
moment I've just decided to add more $var_x parameters.
that smells like bad design (but then again you should see some of my code ;-)
btw: have you met call_user_func_array() yet? (not that it
would solve the problem because it doesn't 'do' references) - also,
it's manual page offers a hack for the reference problem your working on.
Yes, I briefly considered using it. Another method I tried was building
a list of parameters and using eval() to call the function. Since I
can't get the variables by reference, however, I've stuck with just
passing $var_1, $var_2, etc. to the function.
Thanks for your comments. I think the amount of effort I would spend
learning how to use the reflection API compared to just using a defined
number of variables labelled in sequence is not worth it. If there was
another way, perhaps...
i can say with confidence 'no, your **** out of luck'.
Chris
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php