最简单的问题:从数组中提取值

2024-04-27

这是一个例子:

Array ( 
[0] => Array ( [title] => Title_1 [checkout] => 1 [no_gateway] => 0 ) 
[1] => Array ( [title] => Title_2 [checkout] => 1 [no_gateway] => 1 )
[2] => Array ( [title] => Title_3 [checkout] => 0 [no_gateway] => 0 )
[3] => Array ( [title] => Title_4 [checkout] => 1 [no_gateway] => 1 )
[4] => Array ( [title] => Title_5 [checkout] => 0 [no_gateway] => 0 )
[5] => Array ( [title] => Title_6 [checkout] => 1 [no_gateway] => 0 )
)

我需要打印出 [title] 键下具有 [checkout] => 1 & [no_gateway] => 0 的所有值

就我而言,它应该看起来像

  • Title_1
  • Title_6

请帮助 php-beginner :) 谢谢!


foreach($array as $row) {
  if ($row['checkout'] && !$row['no_gateway']) {
    print $row['title'];
  }
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

最简单的问题:从数组中提取值 的相关文章

随机推荐