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

Breadcrumb

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

function AbstractUnicodeString::fromCodePoints

File

vendor/symfony/string/AbstractUnicodeString.php, line 51

Class

AbstractUnicodeString
Represents a string of abstract Unicode characters.

Namespace

Symfony\Component\String

Code

public static function fromCodePoints(int ...$codes) : static {
    $string = '';
    foreach ($codes as $code) {
        if (0x80 > ($code %= 0x200000)) {
            $string .= \chr($code);
        }
        elseif (0x800 > $code) {
            $string .= \chr(0xc0 | $code >> 6) . \chr(0x80 | $code & 0x3f);
        }
        elseif (0x10000 > $code) {
            $string .= \chr(0xe0 | $code >> 12) . \chr(0x80 | $code >> 6 & 0x3f) . \chr(0x80 | $code & 0x3f);
        }
        else {
            $string .= \chr(0xf0 | $code >> 18) . \chr(0x80 | $code >> 12 & 0x3f) . \chr(0x80 | $code >> 6 & 0x3f) . \chr(0x80 | $code & 0x3f);
        }
    }
    return new static($string);
}

API Navigation

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