PHP 8.5.0 RC 2 available for testing

Locale::getScript

locale_get_script

(PHP 5 >= 5.3.0, PHP 7, PHP 8, PECL intl >= 1.0.0)

Locale::getScript -- locale_get_script โ€” Gets the script for the input locale

่ฏดๆ˜Ž

้ขๅ‘ๅฏน่ฑก้ฃŽๆ ผ

public static Locale::getScript(string $locale): ?string

่ฟ‡็จ‹ๅŒ–้ฃŽๆ ผ

locale_get_script(string $locale): ?string

Gets the script for the input locale.

ๅ‚ๆ•ฐ

locale

The locale to extract the script code from

่ฟ”ๅ›žๅ€ผ

The script subtag for the locale or null if not present

็คบไพ‹

็คบไพ‹ #1 locale_get_script() example

<?php
echo locale_get_script('sr-Cyrl');
?>

็คบไพ‹ #2 OO example

<?php
echo Locale::getScript('sr-Cyrl');
?>

ไปฅไธŠ็คบไพ‹ไผš่พ“ๅ‡บ๏ผš

Cyrl

ๅ‚่ง

๏ผ‹ๆทปๅŠ ๅค‡ๆณจ

็”จๆˆท่ดก็Œฎ็š„ๅค‡ๆณจ 1 note

up
1
Patanjali ยถ
8 years ago
locale_get_script does no validation of whether the script exists, but just extracts the 4-character text that looks like it can be the script part of the locale, and formats it with an initial cap.
To Top