Remove values from array on foreach PHP

Posted by user104531 on Server Fault See other posts from Server Fault or by user104531
Published on 2012-11-01T22:59:25Z Indexed on 2012/11/01 23:04 UTC
Read the original article Hit count: 221

Filed under:
|

I have an array like this:

    Array
(
    [0] => Array
        (
            [id] => 68
            [type] => onetype
            [type_id] => 131
            [name] => name1
        )

    [1] => Array
        (
            [id] => 32
            [type] => anothertype
            [type_id] => 101
            [name] => name2
        )
)

I need to remove some arrays from it if the users has permissions or not to see that kind of type. I am thinking on doing it with a for each, and do the needed ifs inside it to remove or let it as it.

My question is: What's the most efficent way to do this? The array will have no more than 100 records. But several users will request it and do the filtering over and over.

© Server Fault or respective owner

Related posts about php

Related posts about array