遇到非数字值 [英] A non-numeric value encountered

查看:27
本文介绍了遇到非数字值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这条线,但我不知道如何更改以跳过此错误

I have this line, but i don't know what to change to skip this error

$media_query = '@media screen and (max-width: ' . intval( Avada()->settings->get( 'side_header_break_point' ) ) - 32 . 'px)';

推荐答案

需要注意的操作顺序为:

You need to pay attention to the order of operation as :

点运算符与 + 和 - 具有相同的优先级,可以产生意想不到的结果.

the dot operator has the same precedence as + and -, which can yield unexpected results.

因此,在您的情况下,您在应用减号操作之前可能"形成了两个字符串,为避免这种情况,您需要添加如下括号:

So in your case you have 'maybe' formed two strings before applying the minus operation, to avoid this you need to add parenthesis like this :

'(max-width: ' . (intval( Avada()->settings->get( 'side_header_break_point' ) ) - 32) . 'px)';

您可以在这里了解更多信息:http://php.net/manual/fa/language.operators.precedence.php

You can learn more here : http://php.net/manual/fa/language.operators.precedence.php

这篇关于遇到非数字值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆