/** * return an array of values filtered by the key ending with $endswith * @param $arr [] * @param $endswith string * @return array */ public static function filterKeyEndsWith(&$arr, $endswith) { $results = array(); foreach ($arr as $key => $value) { if (Str::endsWith($key, $endswith) === true) { $results[$key] = $value; } } return $results; }
public function testEndsWithNull() { $this->assertFalse(Str::endsWith('test', null)); }