gpt4 book ai didi

php - 最简单的问题: extract values from array

转载 作者:可可西里 更新时间:2023-10-31 23:53:10 25 4
gpt4 key购买 nike

这是一个例子:

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 的所有值

在我的例子中它应该是这样的

  • 标题_1
  • Title_6

请帮助 php-beginner :) 谢谢!

最佳答案

foreach($array as $row) {
if ($row['checkout'] && !$row['no_gateway']) {
print $row['title'];
}
}

关于php - 最简单的问题: extract values from array,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3496378/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com