How to set optional parameter to default without passing it?

前端 未结 4 1825
一生所求
一生所求 2020-12-12 02:27

How can i skip first argument without giving any value in function call,so that first argument can take default value NULL?

function test($a = NULL, $b = tru         


        
4条回答
  •  甜味超标
    2020-12-12 02:46

    You can change the position of the arguments, or you can pass the arguments as an array, for exmaple:

    test($options);
    

提交回复
热议问题