Solve a problem!
$arr =array (
Array (' ID ' =>1, ' title ' = ' = ' Category 1 '),
Array (' ID ' =>3, ' title ' = ' = ' Category 3 '),
Array (' ID ' =>2, ' title ' = ' = ' Category 2 '),
Array (' ID ' =>8, ' title ' = ' = ' category 8 '),
Array (' ID ' =>111, ' title ' = ' = ' category 111 '),
);
Delete the array of id=2 in the above array (that is, array (' ID ' =>2, ' title ' = ' = ' Category 2 '))
------Solution--------------------
$arr =array (
Array (' ID ' =>1, ' title ' = ' = ' Category 1 '),
Array (' ID ' =>3, ' title ' = ' = ' Category 3 '),
Array (' ID ' =>2, ' title ' = ' = ' Category 2 '),
Array (' ID ' =>8, ' title ' = ' = ' category 8 '),
Array (' ID ' =>111, ' title ' = ' = ' category 111 '),
);
foreach ($arr as $k = + $v) if ($v [' id '] = = 2) unset ($arr [$k]);
Print_r ($arr);
Array
(
[0] = = Array
(
[id] = 1
[Title] = 1
)
[1] = = Array
(
[id] = 3
[Title] = 3
)
[3] = = Array
(
[id] = 8
[Title] = 8
)
[4] = = Array
(
[id] = 111
[Title] = 111
)
)