mb_substr

Compat function to mimic mb_substr().

Description

(string) mb_substr( (string) $string, (int) $start, (string) $length = 'a' ); 

Returns (string)

the substring of specified length

Parameters (3)

0. $string (string)
The input string
1. $start (int)
The start.
2. $length — Optional. (string) => 'a'
Length the length of the substring

Usage

  1. if ( !function_exists( 'mb_substr' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'breadcrumb-navxt/includes/multibyte_supplicant.php'; 
  3.  
  4. // the input string 
  5. $string = ''; 
  6.  
  7. // The start. 
  8. $start = -1; 
  9.  
  10. // length the length of the substring 
  11. $length = 'a'; 
  12.  
  13. // NOTICE! Understand what this does before running. 
  14. $result = mb_substr($string, $start, $length); 
  15.  

Defined (1)

The function is defined in the following location(s).

/includes/multibyte_supplicant.php  
  1. function mb_substr($string, $start, $length = 'a') 
  2. //This happens to be the easiest way to preserve the behavior of substr 
  3. if($length = 'a') 
  4. return substr($string, $start); 
  5. else 
  6. return substr($string, $start, $length);