src/StringLib.php
/**
     * Checks to see if the string in $haystack begins with $needle.
     * 
     * @param haystack         - the string to search in.
     * @param needle           - the string to look for
     * @param caseSensitive    - whether to enforce case sensitivity or not (default true)
     * @param ignoreWhiteSpace - whether to ignore white space at the ends of the inputs
     * functionfunction
     * @return result - true if the haystack begins with the provided string. False otherwise.
     */
Checks to see if the string in $haystack begins with $needle.

@param haystack         - the string to search in.
@param needle           - the string to look for
@param caseSensitive    - whether to enforce case sensitivity or not (default true)
@param ignoreWhiteSpace - whether to ignore white space at the ends of the inputs
functionfunction
@return result - true if the haystack begins with the provided string. False otherwise.
Checks to see if the string in $haystack begins with $needle . @param haystack - the string to search in . @param needle - the string to look for @param caseSensitive - whether to enforce case sensitivity or not ( default true ) @param ignoreWhiteSpace - whether to ignore white space at the ends of the inputs functionfunction @return result - true if the haystack begins with the provided string . False otherwise .
public static function startsWith($haystack, 
                                      $needle, 
                                      $caseSensitive = true, 
                                      $ignoreWhiteSpace = false)
    {       
        $result = false;
        if ($caseSensitive == false) 
        {
            $haystack = strtolower($haystack);
            $needle = strtolower($needle);
        }
        if ($ignoreWhiteSpace)
        {
            $haystack = trim($haystack);
            $needle = trim($needle);
        }
        if (strpos($haystack, $needle) === 0)
        {
            $result = true;
        }
        return $result;
    }
public static function startsWith ( $ haystack , $ needle , $ caseSensitive = true , $ ignoreWhiteSpace = false ) { $ result = false ; if ( $ caseSensitive == false ) { $ haystack = strtolower ( $ haystack ) ; $ needle = strtolower ( $ needle ) ; } if ( $ ignoreWhiteSpace ) { $ haystack = trim ( $ haystack ) ; $ needle = trim ( $ needle ) ; } if ( strpos ( $ haystack , $ needle ) === 0 ) { $ result = true ; } return $ result ; }
Checks to see if the string in $haystack begins with $needle.
Checks to see if the string in $haystack begins with $needle .
//Reduce to lower case if required.