How can I create a smaller, filtered array based on a larger array. For example, this is the larger array:
$large_array = array(
'user_email' => array(
'required' => true,
'email' => true,
'max' => 200,
'unique' => 'users'),
'password' => array(
'required' => true,
'min' => 6,
'max' => 20),
'password_again' => array(
'required' => true,
'matches' => 'password'),
'name_first' => array(
'required' => false,
'min' => 2,
'max' => 64),
'name_last' => array(
'required' => false,
'min' => 2,
'max' => 64));
I want to create a filtered array based on the 'user_email' and 'name_first' keys from the large array. This filtered array would end up looking like this:
$filtered_array = array(
'user_email' => array(
'required' => true,
'email' => true,
'max' => 200,
'unique' => 'users'),
'name_first' => array(
'required' => false,
'min' => 2,
'max' => 64);
What's the best way to do this in PHP? I'm trying to get a function that takes a set of keys and the $large_array to create the $filtered_array.