0

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?

RonnieT
  • 2,193
  • 4
  • 32
  • 43
  • 2
    I don't see an array in your question – Phil Oct 25 '11 at 22:59
  • There are a ton of ways to exclude it; it depends on what a lot of your code look like. Do you have control over the building of the array or just the display? Are you displaying in a loop? – Explosion Pills Oct 25 '11 at 22:59
  • 2
    That's an object, not an array – Clive Oct 25 '11 at 22:59
  • @RonnieT: Can you show the code with the array or do you want to unset an object property? Or is that a dynamic property even based on some array inside the object? – hakre Oct 25 '11 at 23:13
  • Almost has the same title as yours... https://stackoverflow.com/questions/369602/how-to-delete-an-element-from-an-array-in-php – dispake Oct 25 '11 at 23:40

1 Answers1

0

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.

Ariel
  • 25,995
  • 5
  • 59
  • 69