aboutsummaryrefslogtreecommitdiffhomepage
path: root/application/Utils.php
diff options
context:
space:
mode:
Diffstat (limited to 'application/Utils.php')
-rw-r--r--application/Utils.php16
1 files changed, 14 insertions, 2 deletions
diff --git a/application/Utils.php b/application/Utils.php
index 5b8ca508..da521cce 100644
--- a/application/Utils.php
+++ b/application/Utils.php
@@ -41,8 +41,14 @@ function smallHash($text)
41 41
42/** 42/**
43 * Tells if a string start with a substring 43 * Tells if a string start with a substring
44 *
45 * @param string $haystack Given string.
46 * @param string $needle String to search at the beginning of $haystack.
47 * @param bool $case Case sensitive.
48 *
49 * @return bool True if $haystack starts with $needle.
44 */ 50 */
45function startsWith($haystack, $needle, $case=true) 51function startsWith($haystack, $needle, $case = true)
46{ 52{
47 if ($case) { 53 if ($case) {
48 return (strcmp(substr($haystack, 0, strlen($needle)), $needle) === 0); 54 return (strcmp(substr($haystack, 0, strlen($needle)), $needle) === 0);
@@ -52,8 +58,14 @@ function startsWith($haystack, $needle, $case=true)
52 58
53/** 59/**
54 * Tells if a string ends with a substring 60 * Tells if a string ends with a substring
61 *
62 * @param string $haystack Given string.
63 * @param string $needle String to search at the end of $haystack.
64 * @param bool $case Case sensitive.
65 *
66 * @return bool True if $haystack ends with $needle.
55 */ 67 */
56function endsWith($haystack, $needle, $case=true) 68function endsWith($haystack, $needle, $case = true)
57{ 69{
58 if ($case) { 70 if ($case) {
59 return (strcmp(substr($haystack, strlen($haystack) - strlen($needle)), $needle) === 0); 71 return (strcmp(substr($haystack, strlen($haystack) - strlen($needle)), $needle) === 0);