How do you create optional arguments in php?

后端 未结 6 1681
耶瑟儿~
耶瑟儿~ 2020-11-27 02:54

In the PHP manual, to show the syntax for functions with optional parameters, they use brackets around each set of dependent optional parameter. For example, for the date()

6条回答
  •  庸人自扰
    2020-11-27 03:46

    Give the optional argument a default value.

    function date ($format, $timestamp='') {
    }
    

提交回复
热议问题