$arr[1]['one'] = "1";
$arr[1]['two'] = "2";
echo '<pre>';
print_r($arr);
echo '</pre>';
// Array
// (
// [1] => Array
// (
// [one] => 1
// [two] => 2
// )
// )
echo '<form method="POST">';
foreach ($arr as $key => $val) {
foreach ($val as $k => $v) {
echo "<button name='del[$key]' value='$k'/>удалить $v</button>";
}
}
echo "</form>";
if ($_POST && $_POST['del'] && is_array($_POST['del'])) {
foreach ($_POST['del'] as $k => $v) {
unset($arr[$k][$v]);
}
}
echo '<pre>';
print_r($arr);
echo '</pre>';
// Array
// (
// [1] => Array
// (
// [two] => 2
// )
// )
$arr[1]['one']="1";
$arr[1]['two']="2";
$foo = 1;
$bar = 'one';
foreach( $arr as $k => $sub_arr ) {
foreach( $sub_arr as $sub_k => $sub_v ) {
if( $k === $foo && $sub_k === $bar)
unset($arr[$k][$sub_k]);
}
}