Support Joomla!

Packages

Package: utf8

License

Content on this site is copyright © 2005 - 2008 Open Source Matters Inc and can be used in accordance with the Joomla! Electronic Documentation License. Some parts of this website may be subject to other licenses.
Source code for file /phputf8/stristr.php

Documentation is available at stristr.php

  1. <?php
  2. /**
  3. @version $Id: stristr.php 10381 2008-06-01 03:35:53Z pasamio $
  4. @package utf8
  5. @subpackage strings
  6. */
  7.  
  8. //---------------------------------------------------------------
  9. /**
  10. * UTF-8 aware alternative to stristr
  11. * Find first occurrence of a string using case insensitive comparison
  12. * Note: requires utf8_strtolower
  13. @param string 
  14. @param string 
  15. @return int 
  16. @see http://www.php.net/strcasecmp
  17. @see utf8_strtolower
  18. @package utf8
  19. @subpackage strings
  20. */
  21. function utf8_stristr($str$search{
  22.  
  23.     if strlen($search== {
  24.         return $str;
  25.     }
  26.  
  27.     $lstr utf8_strtolower($str);
  28.     $lsearch utf8_strtolower($search);
  29.     preg_match('|^(.*)'.preg_quote($lsearch).'|Us',$lstr$matches);
  30.  
  31.     if count($matches== {
  32.         return substr($strstrlen($matches[1]));
  33.     }
  34.  
  35.     return FALSE;
  36. }

Documentation generated on Sun, 21 Dec 2008 20:50:25 +0000 by phpDocumentor 1.3.1