Project Modication Blues

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
harrisonad
Forum Contributor
Posts: 288
Joined: Fri Oct 15, 2004 4:58 am
Location: Philippines
Contact:

Project Modication Blues

Post by harrisonad »

Hello,
I have a common function that is used by almost all scripts in my project.
We all know that, OOP in mind, I can change the contents of this function without affecting the outside world. But what if I want to change the order and number of its arguments. Like for example, it used to accept $namestr as argument -

Code: Select all

function foo($name){
. Eventually, I analyzed that it must also accept '$address' argument -

Code: Select all

function foo($namestr,$address){
.
If I do so, then I have to change all function calls (ei.about an hour) to whatever appropriate. This is a waste of time I guess.

In your opinion, what is the best way of dealing with this situation?

Thank you, masters, in advance.
User avatar
Burrito
Spockulator
Posts: 4715
Joined: Wed Feb 04, 2004 8:15 pm
Location: Eden, Utah

Post by Burrito »

set a default value for your second argument and then you don't HAVE to pass anything to it.

if you need to pass stuff on all of your calls, then unfortunately you're going to have to modify them.

an extended find and replace with most editors should do it pretty quickly though...
Post Reply