ltrim.php 528 B

1234567891011121314151617181920212223
  1. <?php
  2. /**
  3. * UTF8::ltrim
  4. *
  5. * @package KO7
  6. *
  7. * @copyright (c) 2007-2016 Kohana Team
  8. * @copyright (c) since 2016 Koseven Team
  9. * @copyright (c) 2005 Harry Fuecks
  10. * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt
  11. */
  12. function _ltrim($str, $charlist = NULL)
  13. {
  14. if ($charlist === NULL)
  15. return ltrim($str);
  16. if (UTF8::is_ascii($charlist))
  17. return ltrim($str, $charlist);
  18. $charlist = preg_replace('#[-\[\]:\\\\^/]#', '\\\\$0', $charlist);
  19. return preg_replace('/^['.$charlist.']+/u', '', $str);
  20. }