我需要一些帮助过滤数组.我有一个提交以下数据的表单.我只想选择QTY为1或更多的数据.
array (size=4)
17 =>
array (size=4)
'id' => string '17' (length=2)
'TicketName' => string 'General admission' (length=17)
'price' => string '50.00' (length=5)
'qty' => string '0' (length=1)
18 =>
array (size=4)
'id' => string '18' (length=2)
'TicketName' => string 'General admission' (length=17)
'price' => string '50.00' (length=5)
'qty' => string '2' (length=1)
19 =>
array (size=4)
'id' => string '19' (length=2)
'TicketName' => string 'General admission' (length=17)
'price' => string '50.00' (length=5)
'qty' => string '0' (length=1)
20 =>
array (size=4)
'id' => string '20' (length=2)
'TicketName' => string 'General admission' (length=17)
'price' => string '50.00' (length=5)
'qty' => string '0' (length=1)
我知道我可以用类似的东西.我不确定如何通过数字键过滤.
$arrays = array_filter($inputs, function($val){
return $val> 0;
});
谢谢