Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Possible to have a php function with two names?

Tags:

function

php

Odd ball question, but I'm stuck with an old function library that has too still be used. My question, is it possible to have a function with two names? ie:

function fReturnFormatedDateOrNull($string, $switch=1), fDoN ($string, $switch=1) {
  gutshere
}

I hate the name space / length of the first name, but I need to keep the function. I would like to use a shorthand name (fDoN) going forward. Or am I stuck creating the new function and calling the old one?

Thanks for your time.

like image 581
Ryan Avatar asked Feb 05 '14 02:02

Ryan


1 Answers

Simply Stated, No

However you can do this to make it easier...

function fReturnFormatedDateOrNull($string, $switch=1) {
    gutshere
}

function fDoN($string, $switch=1) {
    fReturnFormatedDateOrNull($string,$switch);
}
like image 195
Hurricane Development Avatar answered Oct 19 '22 01:10

Hurricane Development