douqu2481 2017-10-09 13:09
浏览 16
已采纳

遇到非数字值

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)';
  • 写回答

1条回答 默认 最新

  • dqqg0811 2017-10-09 13:41
    关注

    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)';
    

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

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
编辑
预览

报告相同问题?

手机看
程序员都在用的中文IT技术交流社区

程序员都在用的中文IT技术交流社区

专业的中文 IT 技术社区,与千万技术人共成长

专业的中文 IT 技术社区,与千万技术人共成长

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

客服 返回
顶部