参照:

https://blog.csdn.net/weixin_43944691/article/details/120530134


原因是:函数的参数带有默认值时,如果不再参数最后,PHP8会提示deprecated。

把默认值去掉,在函数体内做判定即可。