]> git.mxchange.org Git - friendica.git/blobdiff - src/Util/Strings.php
Merge pull request #8727 from MrPetovan/task/8676-ap-attachments
[friendica.git] / src / Util / Strings.php
index 3dd91193d2cc98501f0717f13f31307e527c53e9..04d676ef57364ac87ad5c37cb3aff83a53afd672 100644 (file)
@@ -369,13 +369,27 @@ class Strings
         * @param array  $chars
         * @return bool
         */
-       public static function startsWith($string, array $chars)
+       public static function startsWithChars($string, array $chars)
        {
                $return = in_array(substr(trim($string), 0, 1), $chars);
 
                return $return;
        }
 
+       /**
+        * Check if the first string starts with the second
+        *
+        * @param string $string
+        * @param string $start
+        * @return bool
+        */
+       public static function startsWith(string $string, string $start)
+       {
+               $return = substr_compare($string, $start, 0, strlen($start)) === 0;
+
+               return $return;
+       }
+
        /**
         * Returns the regular expression string to match URLs in a given text
         *