I have a set of functions using a third-party API. From time to time I thought of making it available, since there is no public library in PHP and it makes no difference to keep it as a closed code or not. ( I will still have to change a lot. )
However, since I only use such functions, they have strange names that do not match the actual result, in addition to having no prefix. To solve this I thought of simply renaming the functions and include a prefix.
In this way all functions would change to:
MinhaApi_*
But that would be too long to write, so I thought I'd shorten it to:
ma_*
From there came the curiosity:
Is it possible to have MinhaApi_*
and ma_*
simultaneously, without declaring them twice?
So you can understand, instead of using this:
function MinhaApi_text(){
return 'Isso é um texto';
}
function ma_text(){
return MinhaApi_text();
}
echo ma_text();
Resultado: Isso é um texto
This works, but it requires you to "re-declare" all functions (so I guess that's not the best way).
Use this:
function MinhaApi_text(), ma_text(){
return 'Isso é um texto';
}
echo ma_text();
Resultado "esperado": Isso é um texto
That does not work logically!