Filtering arrays based on an object attribute



Hi,

I have an array filled with a particular type of object, which
contains an attribute "m_level", of integer type. What I want is to
get a subset of the array whose "m_level" attribute is equal to zero.
Is there a short way I can do this other than iterating through a
foreach / for loop?

I'm using PHP 4.4.4.

Thanks, - Dave

.



Relevant Pages

  • Re: the necessity of Lisps Objects?
    ... Could you give me PHP code example snippets of how to: ... If you specify a number beyond the bounds of the integer type, ... I actually ran into this *feature* with some php code that looked like literal ... BTW, of the languages I have worked with, php seems to be unique in this *feature* ...
    (comp.lang.lisp)
  • Re: Filtering arrays based on an object attribute
    ... contains an attribute "m_level", of integer type. ... foreach / for loop? ... I'm using PHP 4.4.4. ... Using Opera's revolutionary e-mail client: http://www.opera.com/mail/ ...
    (comp.lang.php)
  • Re: the necessity of Lisps Objects?
    ... integer type. ... Could you give me PHP code example snippets of how to: ...
    (comp.lang.lisp)
  • Re: Filtering arrays based on an object attribute
    ... contains an attribute "m_level", of integer type. ... get a subset of the array whose "m_level" attribute is equal to zero. ... I'm using PHP 4.4.4. ... foreach { ...
    (comp.lang.php)
  • Re: safe to delete elements of array in foreach
    ... I make it a habit not to delete entries in a foreach() loop. ... Rather, I build an array of keys I want to delete, and after the loop ends, delete the entries from my delete array. ... I don't know whether an operation like this is guaranteed to work in PHP - I've never seen it documented, ...
    (comp.lang.php)