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

PHP多个if else速记错误

$array['something'] ? $a ?$b ? $c : '';

In 3 var there's one have value, and assign it to the array, but It doesn't work.

Are you looking for something like this?

$array['something'] = !empty($a) ? $a : (!empty($b) ? $b : (!empty($c) ? $c : ""));

Only one of $a, $b or $c has a value and assign only that value

Try something like this:

$array['something'] = (($a) ? $a : (($b) ? $b : (($c) ? $c : '')));

近期文章

  • php中的数据库连接问题
  • PHP告诉我填写所有字段[关闭]
  • 两个表 - 如何制定连接
  • 使用php显示图像<img src =“”[关闭]
  • PHP / MySQLi Insert返回空白页面
  • Wordpress自定义用户身份验证
  • Google Translate API返回403(PHP)
  • 两个提交相同表单的按钮
  • 如何对对象数组laravel进行分页?
  • wordpress php按类别名称查询
  • 新安装xampp后出现PHP错误
  • 停止在刷新时消失
  • 使用PHP更新AD密码问题
  • 在PHP中最安全地使用bcrypt [关闭]
  • 函数名称必须是字符串错误
  • 我的图像未从文件夹中删除
  • jQuery Ajax请求通过代理404'ing
  • xampp在htdocs中显示文件夹为空
  • 困惑如何处理数组返回
  • $ _FILE单引号导致空名称

Copyright ©2022 我爱占星 All Rights Reserved.

浙ICP备2022030071号-1

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

友情链接:代码精华