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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.