[thelist] Filtering an array in PHP for multiple criteria

Aaron Vegh aaronvegh at gmail.com
Wed Jun 11 11:00:31 CDT 2008

Hi all,
I've been breaking my brain on this problem for a while now, so I'm
hoping there's some smarter PHP devs on this list than myself! That
shouldn't be too hard. :-P

Assuming an array like this:

Array {
    [0] Object {
         category => "Workboot"
         toe => "Steel"

    [1] Object {
        category => "Workboot"
        toe => "Aluminum"

    [2] Object {
        category => "Athletic"
        toe => "Steel"

The user has to choose from a number of criteria. If they choose the
Workboot category and Steel toe, then the result array should contain
only the first object in the array above. How the heck do you write a
function that would do that??? Owing to the way the database and
application are set up, I can't pull the results from the database
using SQL; I have to get the entire catalogue out of the database, and
then filter the results as they appear in this array. Any thoughts or
pointers would be received gratefully. :-)


Aaron Vegh, Principal
Innoveghtive Inc.
P: (647) 477-2690
C: (905) 924-1220

More information about the thelist mailing list