CoreFiles by mySites.guru
strspn.php36 lines, 834 bytes, from Joomla_1.5.0-Stable-Full_Package.zip
Raw History Compare with 1.0.15
md5
8aae49d5eed6539ca4186aba7011a3ef
sha1
4789f4b8cace15a1abe92d2d583d0e9664501a83
sha256
857aeeb619b6a944b80164ae445a476f776986e4aa04ca7b8d2ec1c53c0f90dd
<?php
/**
* @version $Id: strspn.php 7692 2007-06-08 20:41:29Z tcp $
* @package utf8
* @subpackage strings
*/

//---------------------------------------------------------------
/**
* UTF-8 aware alternative to strspn
* Find length of initial segment matching mask
* Note: requires utf8_strlen and utf8_substr (if start, length are used)
* @param string
* @return int
* @see http://www.php.net/strspn
* @package utf8
* @subpackage strings
*/
function utf8_strspn($str, $mask, $start = NULL, $length = NULL) {

    $mask = preg_replace('!([\\\\\\-\\]\\[/^])!','\\\${1}',$mask);

    if ( $start !== NULL || $length !== NULL ) {
        $str = utf8_substr($str, $start, $length);
    }

    preg_match('/^['.$mask.']+/u',$str, $matches);

    if ( isset($matches[0]) ) {
        return utf8_strlen($matches[0]);
    }

    return 0;

}

The same content is in 4 releases, Joomla 1.5.0 to 1.5.3. See them all, or every version of this file.