Jump to content

[SOLVED] Multiple function names?


acctman

Recommended Posts

something like this... would that work? or does each function have to be separate

function test1($blah), test2($blah) {

do something

}

Why would you define two functions that did the same thing? That makes no sense at all.

 

i have a script of function that is used on multiple site. to avoid conflicts and going through multiple files renaming functions I thought it would just be easier to have a function with multiple names

i have a script of function that is used on multiple site. to avoid conflicts and going through multiple files renaming functions I thought it would just be easier to have a function with multiple names

 

I would assume the opposite.  Wouldn't you want to have consistent names?  Making two functions that have the same exact effect would make no sense at all.

Agreed...I would try and keep things consistent. If you change the name of the function for some reason, and want to keep the old name for depreciation purposes, I would have the old function name call the new function name. This way you can also add a piece that either displays a DEPRECIATED message, or sends an email to an admin notifying them that something is using the depreciated function name.

What rhodesa said.

 

In all of my programs I use set_error_handler() to define my own error handler that logs errors to a file.

 

When a piece of code becomes deprecated, I perform the following:

function DoSomething() {
  trigger_error( 'DEPRECATED: ' . __FUNCTION__ . ' is deprecated, use DoSomethingNew() instead.' );
  DoSomethingNew();
}

function DoSomethingNew() {
  // Replaces DoSomething()
  // Function body follows...
}

 

Then once per day, week, or month I have the error log e-mailed to me and start a new one.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.