Merge branch 'maint/7.0'
[ninja.git] / system / core / utf8 / rtrim.php
blobefa0e19d5b8859c6cccdcc6c51d8df39a484a76e
1 <?php defined('SYSPATH') OR die('No direct access allowed.');
2 /**
3 * utf8::rtrim
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 _rtrim($str, $charlist = NULL)
13 if ($charlist === NULL)
14 return rtrim($str);
16 if (utf8::is_ascii($charlist))
17 return rtrim($str, $charlist);
19 $charlist = preg_replace('#[-\[\]:\\\\^/]#', '\\\\$0', $charlist);
21 return preg_replace('/['.$charlist.']++$/uD', '', $str);