Last active
August 29, 2015 14:27
-
-
Save VeryCrazyDog/42df72bdc16375d58d11 to your computer and use it in GitHub Desktop.
Helper Functions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// String | |
function startsWith($haystack, $needle) { | |
return $needle === '' || strrpos ( $haystack, $needle, - strlen ( $haystack ) ) !== false; | |
} | |
function endsWith($haystack, $needle) { | |
$length = strlen ( $needle ); | |
return (substr ( $haystack, - $length, $length ) === $needle); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment