Maybe I’m missing something here, but array_diff() seems to be leaving me empty kesys at the end of an array.
With this example data –
$term_ids = array(0 => 242, 1 => 270);
$term_ids = array_diff($term_ids, array(242, 243, 266, 267, 268, 269));
I am being left with this –
Array
(
[1] => 270
[0] =>
)
From what I understand, this is incorrect ([0] should be unset, leaving just [1]). I am using $term_ids = array_values($term_ids); after to make the keys correct, but it seems that this should not be necessary, so I’m wondering if someone who knows more than me could clarify?
I tried
?>
and I got [1] => 16, [3] => 18.
This actually seems to be the intended result as the example on the offical page shows.