DevHow: Code Snippets from all around

Filter Key Values from an Array

URL: http://codeigniter.com/forums/viewthread/113258/#572417

Tag(s): PHP

A PHP script to filter and only allow some of the array keys.

function filter_input_data($data, $allowed)
{
     $allowed = array_flip($allowed);
     return array_intersect_key($data, $allowed);
}

Comments

You must be logged in to comment