CoreFiles by mySites.guru
strspn.php36 lines, 839 bytes, from Joomla_1.5.21-Stable-Full_Package.zip
Raw History Compare with 1.5.20
md5
16fb8bc7e40a14135671b69d46b20048
sha1
4b44ba84618278bcbf1b9f1419be94cdeaff0286
sha256
4c98d22b66b64fd532f3fde6f8e95358dd1fdd07ab82104f73d35af6f4201fc3
<?php
/**
* @version $Id: strspn.php 10381 2008-06-01 03:35:53Z pasamio $
* @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 23 releases, Joomla 1.5.4 to 1.5.26. See them all, or every version of this file.