Michael Shadle wrote:
On Thu, Dec 9, 2010 at 2:38 AM, Andrey Hristov <p...@hristov.com> wrote:

Yes, as the documentation will mention how to do it, for old applications.
For new apps it is easy - pass all the information you need as parameter to
the function. It works in other languages, why shouldn't it work for PHP?

named parameters would help here. otherwise you wind up with a mess of
argument hell. or passing a single array in and then in the function
parsing that for the items (which is what I do, sort of a userland way
of doing named parameters)

but adding more and more parameters to functions over time leads to
issues if they do not have default values and if you have to pass say,
the 6th parameter, but don't need to pass the rest, etc.


You can be creative and create ad-hoc objects with properties the variables you pass, but this is a kind of hack. Also reorganizing your code so not every function needs 6 parameters can help your code.
Globals definitely don't help reusability.

Best,
Andrey

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to