Bump version to 3.3.6
[kohana-core.git] / utf8 / strrpos.php
blob0565dbf371ea8280ce288fb5008c996a6d31537d
1 <?php defined('SYSPATH') OR die('No direct script access.');
2 /**
3 * UTF8::strrpos
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 _strrpos($str, $search, $offset = 0)
13 $offset = (int) $offset;
15 if (UTF8::is_ascii($str) AND UTF8::is_ascii($search))
16 return strrpos($str, $search, $offset);
18 if ($offset == 0)
20 $array = explode($search, $str, -1);
21 return isset($array[0]) ? UTF8::strlen(implode($search, $array)) : FALSE;
24 $str = UTF8::substr($str, $offset);
25 $pos = UTF8::strrpos($str, $search);
26 return ($pos === FALSE) ? FALSE : ($pos + $offset);