Skip to content

Instantly share code, notes, and snippets.

@jatubio
Created May 24, 2015 18:11
Show Gist options
  • Save jatubio/00ff81c042d907c8fc0a to your computer and use it in GitHub Desktop.
Save jatubio/00ff81c042d907c8fc0a to your computer and use it in GitHub Desktop.
array_change_key_case for stdClass Objects
// Works withs stdClass Objects
static function array_change_key_case($input, $case )
{
$array = array_change_key_case((array)$input, $case );
return (object) $array;
}
@jatubio
Copy link
Author

jatubio commented May 24, 2015

Sample to lower case keys of a fetched query with Query Builder of Laravel:

return array_change_key_case($this->app->make('db')->table($table)->where($data)->first(), CASE_LOWER);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment