A_Z_Listing_Grouping::maybe_mb_substr( string $string, int $start, int $length )

Perform a multibyte substring operation if mbstring is loaded, else use substr.


Description


Parameters

$string

(string) (Required) The string to extract the substring from.

$start

(int) (Required) Start the substring at this character number (starts at zero).

$length

(int) (Required) Number of characters to include in the substring.


Source

File: classes/class-a-z-listing-grouping.php

	public static function maybe_mb_substr( $string, $start, $length ) {
		if ( extension_loaded( 'mbstring' ) ) {
			return mb_substr( $string, $start, $length, 'UTF-8' );
		}
		return substr( $string, $start, $length );
	}

Changelog

Changelog
VersionDescription
2.1.0Introduced.


User Contributed Notes

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.