Skip to content

Instantly share code, notes, and snippets.

@coolhome
Created May 18, 2013 20:52
Show Gist options
  • Save coolhome/5605756 to your computer and use it in GitHub Desktop.
Save coolhome/5605756 to your computer and use it in GitHub Desktop.
<?php
/**
* Get a subset of the items from the input data.
*
* @param array $keys
* @return array
*/
public function only($keys)
{
$keys = is_array($keys) ? $keys : func_get_args();
$input = $this->input();
$results = array_only($input, $keys);
return array_merge(array_fill_keys($keys, null), $results);
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment