CoreFiles by mySites.guru
stristr.php36 lines, 833 bytes, from Joomla_1.5.21-Stable-Full_Package.zip
Raw History Compare with 1.5.20
md5
0a2aa5fc0513169b1ebf3a1d6547e675
sha1
e61922c24593ce4dc308206ed8539b1eb67b47f9
sha256
2075d33f314ab59f68ec412a185d7ee35ebbf45f633d84e004297c6091a3787a
<?php
/**
* @version $Id: stristr.php 10381 2008-06-01 03:35:53Z pasamio $
* @package utf8
* @subpackage strings
*/

//---------------------------------------------------------------
/**
* UTF-8 aware alternative to stristr
* Find first occurrence of a string using case insensitive comparison
* Note: requires utf8_strtolower
* @param string
* @param string
* @return int
* @see http://www.php.net/strcasecmp
* @see utf8_strtolower
* @package utf8
* @subpackage strings
*/
function utf8_stristr($str, $search) {

    if ( strlen($search) == 0 ) {
        return $str;
    }

    $lstr = utf8_strtolower($str);
    $lsearch = utf8_strtolower($search);
    preg_match('|^(.*)'.preg_quote($lsearch).'|Us',$lstr, $matches);

    if ( count($matches) == 2 ) {
        return substr($str, strlen($matches[1]));
    }

    return FALSE;
}

The same content is in 23 releases, Joomla 1.5.4 to 1.5.26. See them all, or every version of this file.