Bump version to 3.3.6
[kohana-core.git] / utf8 / stristr.php
blob11797270ddc91f3bdf91f3697f80f378ce5146b4
1 <?php defined('SYSPATH') OR die('No direct script access.');
2 /**
3 * UTF8::stristr
5 * @package Kohana
6 * @author Kohana Team
7 * @copyright (c) 2007-2012 Kohana Team
8 * @copyright (c) 2005 Harry Fuecks
9 * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt
11 function _stristr($str, $search)
13 if (UTF8::is_ascii($str) AND UTF8::is_ascii($search))
14 return stristr($str, $search);
16 if ($search == '')
17 return $str;
19 $str_lower = UTF8::strtolower($str);
20 $search_lower = UTF8::strtolower($search);
22 preg_match('/^(.*?)'.preg_quote($search_lower, '/').'/s', $str_lower, $matches);
24 if (isset($matches[1]))
25 return substr($str, strlen($matches[1]));
27 return FALSE;