php - 逻辑编程帮助

标签 php logic

A = if infos !empty 和 inputs 为空 - 删除;

B = if infos 为空且inputs !empty - 添加;

C = if infos !empty and inputs !equal to infos - 添加;

我们可以这样:

if B //it's the most common operation, so at the beginning.
{
  //add 
}
else
{
 //remove
}
elseif(c) 
{
 //the same add
} 

我相信这可以是更好的想法。我可以得到你的帮助吗?

提前致谢

最佳答案

if (B || C) 
{
  //add 
}
else
{
 //remove
}

关于php - 逻辑编程帮助,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3635089/

相关文章:

javascript - 我的 JS 代码适合 '99 Bottles of Beer on the Wall' 歌曲吗?

functional-programming - 逻辑和函数式编程在gcd的实现上的区别

c - 在两列中查找匹配项并替换

php - 代码和 SQL 查询中有什么错误?为什么网页上没有任何显示?

javascript - 我可以从 HTML 表单中读取输入并将其保存在 TXT 文件中的特定位置吗?

php - 当 id 被转换为整数而不是字符串时,mysqli 准备语句更新查询失败

logic - Agda 中的排中律

php - 创建 PDO 查询时参数中的数组

php - fatal error : Call to a member function library() on a non-object

c++ - 排序链表实现,得到相同的链表