Skip to content

Commit

Permalink
added starts_with helper
Browse files Browse the repository at this point in the history
  • Loading branch information
Athlon1600 committed Dec 23, 2017
1 parent 70b1b86 commit 8d2c953
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,17 @@ function clean_content_type($content_type){
return trim(preg_replace('@;.*@', '', $content_type));
}

function starts_with($haystack, $needles){
foreach( (array)$needles as $n){
if($n !== '' && stripos($haystack, $n) === 0){
return true;
}
}

return false;
}


function is_html($content_type){
return clean_content_type($content_type) == 'text/html';
}
Expand Down

0 comments on commit 8d2c953

Please sign in to comment.