Skip to content

Commit 8d2c953

Browse files
committed
added starts_with helper
1 parent 70b1b86 commit 8d2c953

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/helpers.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,17 @@ function clean_content_type($content_type){
77
return trim(preg_replace('@;.*@', '', $content_type));
88
}
99

10+
function starts_with($haystack, $needles){
11+
foreach( (array)$needles as $n){
12+
if($n !== '' && stripos($haystack, $n) === 0){
13+
return true;
14+
}
15+
}
16+
17+
return false;
18+
}
19+
20+
1021
function is_html($content_type){
1122
return clean_content_type($content_type) == 'text/html';
1223
}

0 commit comments

Comments
 (0)