在php8 中+/-优先级高于php连接符,需要用括号来强制分隔
使用 strtotime() 时,使用了+ 号报错。错误信息为
The behavior of unparenthesized expressions containing both '.' and '+'/'-' will change in PHP 8: '+'/'-' will take a higher precedence。
代码用法:
strtotime( "+" . $i-$week .' days', $time)
应该修改为:
strtotime( "+" . ($i-$week) .' days', $time)
这里提示了,在php8 中+/-的优先及要高于php 连接符。所以这里使用括号来强制分隔避免意想不到的问题。
本文来自互联网用户投稿,文章观点仅代表作者本人,不代表本站立场,不承担相关法律责任。如若转载,请注明出处。 如若内容造成侵权/违法违规/事实不符,请点击【内容举报】进行投诉反馈!
