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

yma*_*kux 3 php arrays foreach

所以这是一个例子:

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 )
)
Run Code Online (Sandbox Code Playgroud)

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

在我的情况下它应该看起来像

  • TITLE_1
  • Title_6

请帮助php-beginner :)谢谢!

Jam*_*ong 9

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