我爱占星网 我爱占星网
首页
编程
java
php
前端
首页 编程 java php 前端

检查值是否为N / A.

I am integrating an API and in some cases bonus field return value N/A and I want not to show N/A on the page.If the field has any text other than N/A then it shows the text.

I tried this:

    if(trim($value) != "N/A" && !is_null($value))
    {
        echo $value;
    }

But the above condition is not working.

Can anyone help me to make it working.

Thanks in advance.

One answer from the oneliners club:

empty($value) or $value == 'N/A' or print($value);

"print" will only be reached if the $value is not set and is not "N/A"

近期文章

  • 按特定顺序运行PHP函数
  • PHP - 将货币代码转换为名称
  • 使用PHP将%20转换为空格[复制]
  • 在js对象中插入转换后的Php数组
  • Php除以没有小数单独的结果
  • 在php文件wordpress变量访问上使用css样式
  • 使用PHP进行简单的表单验证 - 登录屏幕[重复]
  • 使用numpy保存图像的缺点?
  • 打开idea时提示安卓插件异常
  • 求大神解答一下这是神魔情况 试了几个版本都这样,程序无法运行·用C写的
  • 请赐教:有向切换网络指什么网?
  • c++题目求解!!读取文本并计算单词数
  • 如何通过php查询使URL友好SEO [重复]
  • 如何以高级方式打印多维数组?
  • 多维数组层次结构
  • 我不能安装laravel护照
  • 2个Laravel项目在一个DataBase上
  • php - 不会根据iframe中的referrer父URL重定向
  • 单击另一页上的按钮时从表中回显值
  • 在php中的foreach循环中获取项目选择的值

Copyright ©2022 我爱占星 All Rights Reserved.

浙ICP备2022030071号-1

部分图文来自网络,如有侵犯您的版权,请告诉我们删除

友情链接:代码精华