How to alias a function in PHP?

前端 未结 15 1211
死守一世寂寞
死守一世寂寞 2020-11-30 00:13

Is it possible to alias a function with a different name in PHP? Suppose we have a function with the name sleep. Is there a way to make an alias called wa

15条回答
  •  既然无缘
    2020-11-30 00:52

    No, there's no quick way to do this in PHP. The language does not offer the ability to alias functions without writing a wrapper function.

    If you really really really needed this, you could write a PHP extension that would do this for you. However, to use the extension you'd need to compile your extension and configure PHP to us this extension, which means the portability of your application would be greatly reduced.

提交回复
热议问题