How to alias a function in PHP?

前端 未结 15 1201
死守一世寂寞
死守一世寂寞 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 01:02

    PHP 5.6+ only

    Starting with PHP 5.6 it is possible to alias a function by importing it:

    use function sleep as wait;
    

    There's also an example in the documentation (see "aliasing a function").

提交回复
热议问题