PageRenderTime 46ms CodeModel.GetById 20ms RepoModel.GetById 0ms app.codeStats 0ms

/system/core/utf8/rtrim.php

https://github.com/lmorchard/friendfeedarchiver
PHP | 22 lines | 10 code | 3 blank | 9 comment | 2 complexity | 3b30317e850f32df415f3f9619559c92 MD5 | raw file
  1. <?php defined('SYSPATH') or die('No direct script access.');
  2. /**
  3. * utf8::rtrim
  4. *
  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
  10. */
  11. function _rtrim($str, $charlist = NULL)
  12. {
  13. if ($charlist === NULL)
  14. return rtrim($str);
  15. if (utf8::is_ascii($charlist))
  16. return rtrim($str, $charlist);
  17. $charlist = preg_replace('#[-\[\]:\\\\^/]#', '\\\\$0', $charlist);
  18. return preg_replace('/['.$charlist.']++$/uD', '', $str);
  19. }