Most of my program functions use the first approach

I have what ever must be given because the nature of the functions only
exists because it does certain things.

I then have the last argurment passed be an array.  This will contain all
the data that I might want to use inside the function other then the
required fields.

for example I have a 'BOXTOP()' and 'BOXBOTTOM()' function set.

for the 'BOXTOP()' function I require the first argument but after that is
an array.

with this, I can customize the with of my box and if it isn't given it
defaults to a predefined with.

I can do the same thing with themes, colors, borders, cellpadding,
cellspacing, etc...

Then it will pass this same information to the corresponding 'BOXBOTTOM()'
function.

This keeps things very nice and clean.

inside the 'BOXTOP()' function is a mess, but once it is how you want it,
you will find that it is very easy to work with functions formated like
this.


Jim Lucas

----- Original Message ----- 
From: "Hardik Doshi" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, August 15, 2003 8:53 AM
Subject: [PHP] Function arguments


> Hi Group,
>
> I have a question on overloaded function.
>
> What is the best way to pass the arguments so it is
> easy to maintain in future if function behaviour
> changes by adding/removing one or more arguments?
>
> Currently i am passing arguments in array. But i think
> it is not the clean way to do it and another approach
> i am using is functionName(arg1, arg2='', arg3='') but
> here again i think it is not easy to maintain.
>
> Please let me know if you guys have other options or
> improved version of above options.
>
> Thanks
>
> Hardik
>
> __________________________________
> Do you Yahoo!?
> Yahoo! SiteBuilder - Free, easy-to-use web site design software
> http://sitebuilder.yahoo.com
>
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to