A function inside an if structure

前端 未结 5 618
执笔经年
执笔经年 2020-12-31 02:42

can I put a function in PHP inside a if structure? like this:



        
5条回答
  •  灰色年华
    2020-12-31 03:18

    It looks a bit strange, but yes it's legal

    As of PHP 5.3 if you need a function with a limited scope (say for a callback) you can use anonymous functions / closures

提交回复
热议问题