コード例 #1
0
ファイル: Arr.php プロジェクト: twhiston/twlib
 /**
  * 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;
 }
コード例 #2
0
ファイル: StrTest.php プロジェクト: twhiston/twlib
 public function testEndsWithNull()
 {
     $this->assertFalse(Str::endsWith('test', null));
 }