使用表數(shù)組的索引(代碼中的$key)并使用 取消設(shè)置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貢獻(xiàn)1780條經(jīng)驗(yàn) 獲得超1個(gè)贊
我想這應(yīng)該是這樣的:
$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 關(guān)注
- 142 瀏覽
添加回答
舉報(bào)
0/150
提交
取消