Added arrayLower() method

This commit is contained in:
Andy Miller
2019-07-10 11:01:17 -06:00
parent 3c2b17853c
commit e13a8304e6
2 changed files with 12 additions and 0 deletions

View File

@@ -3,6 +3,7 @@
1. [](#new)
* Added support for custom `FormFlash` save locations
* Added a new `Utils::arrayLower()` method for lowercasing arrays
1. [](#improved)
* Use new `Utils::getSupportedPageTypes()` to enforce `html,htm` at the front of the list [#2531](https://github.com/getgrav/grav/issues/2531)
1. [](#bugfix)

View File

@@ -323,6 +323,17 @@ abstract class Utils
return (object)array_merge((array)$obj1, (array)$obj2);
}
/**
* Lowercase an entire array. Useful when combined with `in_array()`
*
* @param array $a
* @return array|false
*/
public static function arrayLower(Array $a)
{
return array_combine(array_map('strtolower', $a), $a);
}
/**
* Simple function to remove item/s in an array by value
*