PageRenderTime 54ms CodeModel.GetById 21ms RepoModel.GetById 1ms app.codeStats 0ms

/system/utf8/strrpos.php

https://bitbucket.org/emolina/asesores
PHP | 27 lines | 15 code | 3 blank | 9 comment | 3 complexity | 86588f88878d96795f3812640c8c4a68 MD5 | raw file
Possible License(s): BSD-3-Clause
  1. <?php defined('SYSPATH') or die('No direct script access.');
  2. /**
  3. * UTF8::strrpos
  4. *
  5. * @package Kohana
  6. * @author Kohana Team
  7. * @copyright (c) 2007-2010 Kohana Team
  8. * @copyright (c) 2005 Harry Fuecks
  9. * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt
  10. */
  11. function _strrpos($str, $search, $offset = 0)
  12. {
  13. $offset = (int) $offset;
  14. if (UTF8::is_ascii($str) AND UTF8::is_ascii($search))
  15. return strrpos($str, $search, $offset);
  16. if ($offset == 0)
  17. {
  18. $array = explode($search, $str, -1);
  19. return isset($array[0]) ? UTF8::strlen(implode($search, $array)) : FALSE;
  20. }
  21. $str = UTF8::substr($str, $offset);
  22. $pos = UTF8::strrpos($str, $search);
  23. return ($pos === FALSE) ? FALSE : ($pos + $offset);
  24. }