Exclude an ID from array in PHP

1.1k Views Asked by At

How can I exclude a certain ID being pulled from an array on the below?

<?php echo $EM_Category->id; ?>

The array is pulling all ID's but I want to exclude a specific one and include the rest.

Would it be by using unset to remove the specific ID?

1

There are 1 best solutions below

0
On

You can usset it or use array_diff_key().

PS. Your code doesn't make sense. You claim to have a bunch of IDs, but you are echoing just one. Probably you need to paste in some more of your code.