使用表数组的索引(代码中的$key)并使用 取消设置unset($tables[$key]。function availableTables($tables, $tablesWithDate) { $tablesReturn = array(); foreach($tables as $key => $table) { foreach($tablesWithDate as $twd) { if($table['table_no'] == $twd['number']){ unset($tables[$key]); } else { echo "false"; } } } return $tables; }
1 回答
慕神8447489
TA贡献1780条经验 获得超1个赞
我想这应该是这样的:
$options = [];
foreach ($eventCats as $cat) {
// Add an element to array under key `$cat->category`
// Value of the element will be result of calling `__` function
$options[$cat->category] = __( $cat->category, 'plugin-domain');
}
- 1 回答
- 0 关注
- 108 浏览
添加回答
举报
0/150
提交
取消