Merge branch 'maint/7.0'
[ninja.git] / system / core / utf8 / strlen.php
blobf186a9c54865e39083cf51803165cf1f90027138
1 <?php defined('SYSPATH') OR die('No direct access allowed.');
2 /**
3 * utf8::strlen
5 * @package Core
6 * @author Kohana Team
7 * @copyright (c) 2007 Kohana Team
8 * @copyright (c) 2005 Harry Fuecks
9 * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt
11 function _strlen($str)
13 // Try mb_strlen() first because it's faster than combination of is_ascii() and strlen()
14 if (SERVER_UTF8)
15 return mb_strlen($str);
17 if (utf8::is_ascii($str))
18 return strlen($str);
20 return strlen(utf8_decode($str));