Source for file core.php
Documentation is available at core.php
* @version $Id: core.php,v 1.1 2007/09/09 20:39:50 pitlinz Exp $
* Define UTF8_CORE as required
//--------------------------------------------------------------------
* Wrapper round mb_strlen
* Assumes you have mb_internal_encoding to UTF-8 already
* Note: this function does not count bad bytes in the string - these
* @param string UTF-8 string
* @return int number of UTF-8 characters in string
//--------------------------------------------------------------------
* Assumes mbstring internal encoding is set to UTF-8
* Wrapper around mb_strpos
* Find position of first occurrence of a string
* @param string needle (you should validate this with utf8_is_valid)
* @param integer offset in characters (from left)
* @return mixed integer position or FALSE on failure
if ( $offset ===
FALSE ) {
//--------------------------------------------------------------------
* Assumes mbstring internal encoding is set to UTF-8
* Wrapper around mb_strrpos
* Find position of last occurrence of a char in a string
* @param string needle (you should validate this with utf8_is_valid)
* @param integer (optional) offset (from left)
* @return mixed integer position or FALSE on failure
if ( $offset ===
FALSE ) {
# Emulate behaviour of strrpos rather than raising warning
trigger_error('utf8_strrpos expects parameter 3 to be long',E_USER_WARNING);
if ( FALSE !==
( $pos =
mb_strrpos($str, $search) ) ) {
//--------------------------------------------------------------------
* Assumes mbstring internal encoding is set to UTF-8
* Wrapper around mb_substr
* Return part of a string given character offset (and optionally length)
* @param integer number of UTF-8 characters offset (from left)
* @param integer (optional) length in UTF-8 characters from offset
* @return mixed string or FALSE if failure
if ( $length ===
FALSE ) {
//--------------------------------------------------------------------
* Assumes mbstring internal encoding is set to UTF-8
* Wrapper around mb_strtolower
* Make a string lowercase
* Note: The concept of a characters "case" only exists is some alphabets
* such as Latin, Greek, Cyrillic, Armenian and archaic Georgian - it does
* not exist in the Chinese alphabet, for example. See Unicode Standard
* Annex #21: Case Mappings
* @return mixed either string in lowercase or FALSE is UTF-8 invalid
//--------------------------------------------------------------------
* Assumes mbstring internal encoding is set to UTF-8
* Wrapper around mb_strtoupper
* Make a string uppercase
* Note: The concept of a characters "case" only exists is some alphabets
* such as Latin, Greek, Cyrillic, Armenian and archaic Georgian - it does
* not exist in the Chinese alphabet, for example. See Unicode Standard
* Annex #21: Case Mappings
* @return mixed either string in lowercase or FALSE is UTF-8 invalid
Documentation generated on Thu, 08 Jan 2009 17:40:15 +0100 by phpDocumentor 1.4.0a2