Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Mbstring.php

function Mbstring::mb_substr

5 calls to Mbstring::mb_substr()
Mbstring::getSubpart in vendor/symfony/polyfill-mbstring/Mbstring.php
Mbstring::mb_strrchr in vendor/symfony/polyfill-mbstring/Mbstring.php
Mbstring::mb_strrichr in vendor/symfony/polyfill-mbstring/Mbstring.php
Mbstring::mb_strrpos in vendor/symfony/polyfill-mbstring/Mbstring.php
Mbstring::mb_str_pad in vendor/symfony/polyfill-mbstring/Mbstring.php

File

vendor/symfony/polyfill-mbstring/Mbstring.php, line 644

Class

Mbstring
Partial mbstring implementation in PHP, iconv based, UTF-8 centric.

Namespace

Symfony\Polyfill\Mbstring

Code

public static function mb_substr($s, $start, $length = null, $encoding = null) {
    $encoding = self::getEncoding($encoding);
    if ('CP850' === $encoding || 'ASCII' === $encoding) {
        return (string) substr($s, $start, null === $length ? 2147483647 : $length);
    }
    if ($start < 0) {
        $start = iconv_strlen($s, $encoding) + $start;
        if ($start < 0) {
            $start = 0;
        }
    }
    if (null === $length) {
        $length = 2147483647;
    }
    elseif ($length < 0) {
        $length = iconv_strlen($s, $encoding) + $length - $start;
        if ($length < 0) {
            return '';
        }
    }
    return (string) iconv_substr($s, $start, $length, $encoding);
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal