PHP Manual
Function Reference
Human Language and Character Encoding Support
Enchant
Gender
Gettext
iconv
intl
Multibyte String
Pspell
Recode
ob_iconv_handler
Introduction
Human Language and Character Encoding Support
PHP Manual
Internationalization Functions
Table of Contents
Introduction
Installing/Configuring
Requirements
Installation
Runtime Configuration
Predefined Constants
Examples
Basic usage of this extension
Collator
— The Collator class
Collator::asort
— Sort array maintaining index association
Collator::compare
— Compare two Unicode strings
Collator::__construct
— Create a collator
Collator::create
— Create a collator
Collator::getAttribute
— Get collation attribute value
Collator::getErrorCode
— Get collator's last error code
Collator::getErrorMessage
— Get text for collator's last error code
Collator::getLocale
— Get the locale name of the collator
Collator::getSortKey
— Get sorting key for a string
Collator::getStrength
— Get current collation strength
Collator::setAttribute
— Set collation attribute
Collator::setStrength
— Set collation strength
Collator::sort
— Sort array using specified collator
Collator::sortWithSortKeys
— Sort array using specified collator and sort keys
NumberFormatter
— The NumberFormatter class
NumberFormatter::create
— Create a number formatter
NumberFormatter::format
— Format a number
NumberFormatter::formatCurrency
— Format a currency value
NumberFormatter::getAttribute
— Get an attribute
NumberFormatter::getErrorCode
— Get formatter's last error code
NumberFormatter::getErrorMessage
— Get formatter's last error message
NumberFormatter::getLocale
— Get formatter locale
NumberFormatter::getPattern
— Get formatter pattern
NumberFormatter::getSymbol
— Get a symbol value
NumberFormatter::getTextAttribute
— Get a text attribute
NumberFormatter::parse
— Parse a number
NumberFormatter::parseCurrency
— Parse a currency number
NumberFormatter::setAttribute
— Set an attribute
NumberFormatter::setPattern
— Set formatter pattern
NumberFormatter::setSymbol
— Set a symbol value
NumberFormatter::setTextAttribute
— Set a text attribute
Locale
— The Locale class
Locale::acceptFromHttp
— Tries to find out best available locale based on HTTP "Accept-Language" header
Locale::canonicalize
— Canonicalize the locale string
Locale::composeLocale
— Returns a correctly ordered and delimited locale ID
Locale::filterMatches
— Checks if a language tag filter matches with locale
Locale::getAllVariants
— Gets the variants for the input locale
Locale::getDefault
— Gets the default locale value from the INTL global 'default_locale'
Locale::getDisplayLanguage
— Returns an appropriately localized display name for language of the inputlocale
Locale::getDisplayName
— Returns an appropriately localized display name for the input locale
Locale::getDisplayRegion
— Returns an appropriately localized display name for region of the input locale
Locale::getDisplayScript
— Returns an appropriately localized display name for script of the input locale
Locale::getDisplayVariant
— Returns an appropriately localized display name for variants of the input locale
Locale::getKeywords
— Gets the keywords for the input locale
Locale::getPrimaryLanguage
— Gets the primary language for the input locale
Locale::getRegion
— Gets the region for the input locale
Locale::getScript
— Gets the script for the input locale
Locale::lookup
— Searches the language tag list for the best match to the language
Locale::parseLocale
— Returns a key-value array of locale ID subtag elements
Locale::setDefault
— Sets the default runtime locale
Normalizer
— The Normalizer class
Normalizer::getRawDecomposition
— Gets the Decomposition_Mapping property for the given UTF-8 encoded code point
Normalizer::isNormalized
— Checks if the provided string is already in the specified normalization form
Normalizer::normalize
— Normalizes the input provided and returns the normalized string
MessageFormatter
— The MessageFormatter class
MessageFormatter::create
— Constructs a new Message Formatter
MessageFormatter::format
— Format the message
MessageFormatter::formatMessage
— Quick format message
MessageFormatter::getErrorCode
— Get the error code from last operation
MessageFormatter::getErrorMessage
— Get the error text from the last operation
MessageFormatter::getLocale
— Get the locale for which the formatter was created
MessageFormatter::getPattern
— Get the pattern used by the formatter
MessageFormatter::parse
— Parse input string according to pattern
MessageFormatter::parseMessage
— Quick parse input string
MessageFormatter::setPattern
— Set the pattern used by the formatter
IntlCalendar
— The IntlCalendar class
IntlCalendar::add
— Add a (signed) amount of time to a field
IntlCalendar::after
— Whether this objectʼs time is after that of the passed object
IntlCalendar::before
— Whether this objectʼs time is before that of the passed object
IntlCalendar::clear
— Clear a field or all fields
IntlCalendar::__construct
— Private constructor for disallowing instantiation
IntlCalendar::createInstance
— Create a new IntlCalendar
IntlCalendar::equals
— Compare time of two IntlCalendar objects for equality
IntlCalendar::fieldDifference
— Calculate difference between given time and this objectʼs time
IntlCalendar::fromDateTime
— Create an IntlCalendar from a DateTime object or string
IntlCalendar::get
— Get the value for a field
IntlCalendar::getActualMaximum
— The maximum value for a field, considering the objectʼs current time
IntlCalendar::getActualMinimum
— The minimum value for a field, considering the objectʼs current time
IntlCalendar::getAvailableLocales
— Get array of locales for which there is data
IntlCalendar::getDayOfWeekType
— Tell whether a day is a weekday, weekend or a day that has a transition between the two
IntlCalendar::getErrorCode
— Get last error code on the object
IntlCalendar::getErrorMessage
— Get last error message on the object
IntlCalendar::getFirstDayOfWeek
— Get the first day of the week for the calendarʼs locale
IntlCalendar::getGreatestMinimum
— Get the largest local minimum value for a field
IntlCalendar::getKeywordValuesForLocale
— Get set of locale keyword values
IntlCalendar::getLeastMaximum
— Get the smallest local maximum for a field
IntlCalendar::getLocale
— Get the locale associated with the object
IntlCalendar::getMaximum
— Get the global maximum value for a field
IntlCalendar::getMinimalDaysInFirstWeek
— Get minimal number of days the first week in a year or month can have
IntlCalendar::getMinimum
— Get the global minimum value for a field
IntlCalendar::getNow
— Get number representing the current time
IntlCalendar::getRepeatedWallTimeOption
— Get behavior for handling repeating wall time
IntlCalendar::getSkippedWallTimeOption
— Get behavior for handling skipped wall time
IntlCalendar::getTime
— Get time currently represented by the object
IntlCalendar::getTimeZone
— Get the objectʼs timezone
IntlCalendar::getType
— Get the calendar type
IntlCalendar::getWeekendTransition
— Get time of the day at which weekend begins or ends
IntlCalendar::inDaylightTime
— Whether the objectʼs time is in Daylight Savings Time
IntlCalendar::isEquivalentTo
— Whether another calendar is equal but for a different time
IntlCalendar::isLenient
— Whether date/time interpretation is in lenient mode
IntlCalendar::isSet
— Whether a field is set
IntlCalendar::isWeekend
— Whether a certain date/time is in the weekend
IntlCalendar::roll
— Add value to field without carrying into more significant fields
IntlCalendar::set
— Set a time field or several common fields at once
IntlCalendar::setDate
— Set a date fields
IntlCalendar::setDateTime
— Set a date and time fields
IntlCalendar::setFirstDayOfWeek
— Set the day on which the week is deemed to start
IntlCalendar::setLenient
— Set whether date/time interpretation is to be lenient
IntlCalendar::setMinimalDaysInFirstWeek
— Set minimal number of days the first week in a year or month can have
IntlCalendar::setRepeatedWallTimeOption
— Set behavior for handling repeating wall times at negative timezone offset transitions
IntlCalendar::setSkippedWallTimeOption
— Set behavior for handling skipped wall times at positive timezone offset transitions
IntlCalendar::setTime
— Set the calendar time in milliseconds since the epoch
IntlCalendar::setTimeZone
— Set the timezone used by this calendar
IntlCalendar::toDateTime
— Convert an IntlCalendar into a DateTime object
IntlGregorianCalendar
— The IntlGregorianCalendar class
IntlGregorianCalendar::__construct
— Create the Gregorian Calendar class
IntlGregorianCalendar::createFromDate
— Create a new IntlGregorianCalendar instance from date
IntlGregorianCalendar::createFromDateTime
— Create a new IntlGregorianCalendar instance from date and time
IntlGregorianCalendar::getGregorianChange
— Get the Gregorian Calendar change date
IntlGregorianCalendar::isLeapYear
— Determine if the given year is a leap year
IntlGregorianCalendar::setGregorianChange
— Set the Gregorian Calendar the change date
IntlTimeZone
— The IntlTimeZone class
IntlTimeZone::__construct
— Private constructor to disallow direct instantiation
IntlTimeZone::countEquivalentIDs
— Get the number of IDs in the equivalency group that includes the given ID
IntlTimeZone::createDefault
— Create a new copy of the default timezone for this host
IntlTimeZone::createEnumeration
— Get an enumeration over time zone IDs associated with the given country or offset
IntlTimeZone::createTimeZone
— Create a timezone object for the given ID
IntlTimeZone::createTimeZoneIDEnumeration
— Get an enumeration over system time zone IDs with the given filter conditions
IntlTimeZone::fromDateTimeZone
— Create a timezone object from DateTimeZone
IntlTimeZone::getCanonicalID
— Get the canonical system timezone ID or the normalized custom time zone ID for the given time zone ID
IntlTimeZone::getDisplayName
— Get a name of this time zone suitable for presentation to the user
IntlTimeZone::getDSTSavings
— Get the amount of time to be added to local standard time to get local wall clock time
IntlTimeZone::getEquivalentID
— Get an ID in the equivalency group that includes the given ID
IntlTimeZone::getErrorCode
— Get last error code on the object
IntlTimeZone::getErrorMessage
— Get last error message on the object
IntlTimeZone::getGMT
— Create GMT (UTC) timezone
IntlTimeZone::getID
— Get timezone ID
IntlTimeZone::getIDForWindowsID
— Translate a Windows timezone into a system timezone
IntlTimeZone::getOffset
— Get the time zone raw and GMT offset for the given moment in time
IntlTimeZone::getRawOffset
— Get the raw GMT offset (before taking daylight savings time into account
IntlTimeZone::getRegion
— Get the region code associated with the given system time zone ID
IntlTimeZone::getTZDataVersion
— Get the timezone data version currently used by ICU
IntlTimeZone::getUnknown
— Get the "unknown" time zone
IntlTimeZone::getWindowsID
— Translate a system timezone into a Windows timezone
IntlTimeZone::hasSameRules
— Check if this zone has the same rules and offset as another zone
IntlTimeZone::toDateTimeZone
— Convert to DateTimeZone object
IntlTimeZone::useDaylightTime
— Check if this time zone uses daylight savings time
IntlDateFormatter
— The IntlDateFormatter class
IntlDateFormatter::create
— Create a date formatter
IntlDateFormatter::format
— Format the date/time value as a string
IntlDateFormatter::formatObject
— Formats an object
IntlDateFormatter::getCalendar
— Get the calendar type used for the IntlDateFormatter
IntlDateFormatter::getDateType
— Get the datetype used for the IntlDateFormatter
IntlDateFormatter::getErrorCode
— Get the error code from last operation
IntlDateFormatter::getErrorMessage
— Get the error text from the last operation
IntlDateFormatter::getLocale
— Get the locale used by formatter
IntlDateFormatter::getPattern
— Get the pattern used for the IntlDateFormatter
IntlDateFormatter::getTimeType
— Get the timetype used for the IntlDateFormatter
IntlDateFormatter::getTimeZoneId
— Get the timezone-id used for the IntlDateFormatter
IntlDateFormatter::getCalendarObject
— Get copy of formatterʼs calendar object
IntlDateFormatter::getTimeZone
— Get formatterʼs timezone
IntlDateFormatter::isLenient
— Get the lenient used for the IntlDateFormatter
IntlDateFormatter::localtime
— Parse string to a field-based time value
IntlDateFormatter::parse
— Parse string to a timestamp value
IntlDateFormatter::setCalendar
— Sets the calendar type used by the formatter
IntlDateFormatter::setLenient
— Set the leniency of the parser
IntlDateFormatter::setPattern
— Set the pattern used for the IntlDateFormatter
IntlDateFormatter::setTimeZone
— Sets formatterʼs timezone
ResourceBundle
— The ResourceBundle class
ResourceBundle::count
— Get number of elements in the bundle
ResourceBundle::create
— Create a resource bundle
ResourceBundle::get
— Get data from the bundle
ResourceBundle::getErrorCode
— Get bundle's last error code
ResourceBundle::getErrorMessage
— Get bundle's last error message
ResourceBundle::getLocales
— Get supported locales
Spoofchecker
— The Spoofchecker class
Spoofchecker::areConfusable
— Checks if given strings can be confused
Spoofchecker::__construct
— Constructor
Spoofchecker::isSuspicious
— Checks if a given text contains any suspicious characters
Spoofchecker::setAllowedLocales
— Locales to use when running checks
Spoofchecker::setChecks
— Set the checks to run
Spoofchecker::setRestrictionLevel
— Set the restriction level
Transliterator
— The Transliterator class
Transliterator::__construct
— Private constructor to deny instantiation
Transliterator::create
— Create a transliterator
Transliterator::createFromRules
— Create transliterator from rules
Transliterator::createInverse
— Create an inverse transliterator
Transliterator::getErrorCode
— Get last error code
Transliterator::getErrorMessage
— Get last error message
Transliterator::listIDs
— Get transliterator IDs
Transliterator::transliterate
— Transliterate a string
IntlBreakIterator
— The IntlBreakIterator class
IntlBreakIterator::__construct
— Private constructor for disallowing instantiation
IntlBreakIterator::createCharacterInstance
— Create break iterator for boundaries of combining character sequences
IntlBreakIterator::createCodePointInstance
— Create break iterator for boundaries of code points
IntlBreakIterator::createLineInstance
— Create break iterator for logically possible line breaks
IntlBreakIterator::createSentenceInstance
— Create break iterator for sentence breaks
IntlBreakIterator::createTitleInstance
— Create break iterator for title-casing breaks
IntlBreakIterator::createWordInstance
— Create break iterator for word breaks
IntlBreakIterator::current
— Get index of current position
IntlBreakIterator::first
— Set position to the first character in the text
IntlBreakIterator::following
— Advance the iterator to the first boundary following specified offset
IntlBreakIterator::getErrorCode
— Get last error code on the object
IntlBreakIterator::getErrorMessage
— Get last error message on the object
IntlBreakIterator::getLocale
— Get the locale associated with the object
IntlBreakIterator::getPartsIterator
— Create iterator for navigating fragments between boundaries
IntlBreakIterator::getText
— Get the text being scanned
IntlBreakIterator::isBoundary
— Tell whether an offset is a boundaryʼs offset
IntlBreakIterator::last
— Set the iterator position to index beyond the last character
IntlBreakIterator::next
— Advance the iterator the next boundary
IntlBreakIterator::preceding
— Set the iterator position to the first boundary before an offset
IntlBreakIterator::previous
— Set the iterator position to the boundary immediately before the current
IntlBreakIterator::setText
— Set the text being scanned
IntlRuleBasedBreakIterator
— The IntlRuleBasedBreakIterator class
IntlRuleBasedBreakIterator::__construct
— Create iterator from ruleset
IntlRuleBasedBreakIterator::getBinaryRules
— Get the binary form of compiled rules
IntlRuleBasedBreakIterator::getRules
— Get the rule set used to create this object
IntlRuleBasedBreakIterator::getRuleStatus
— Get the largest status value from the break rules that determined the current break position
IntlRuleBasedBreakIterator::getRuleStatusVec
— Get the status values from the break rules that determined the current break position
IntlCodePointBreakIterator
— The IntlCodePointBreakIterator class
IntlCodePointBreakIterator::getLastCodePoint
— Get last code point passed over after advancing or receding the iterator
IntlDatePatternGenerator
— The IntlDatePatternGenerator class
IntlDatePatternGenerator::create
— Creates a new IntlDatePatternGenerator instance
IntlDatePatternGenerator::getBestPattern
— Determines the most suitable date/time format
IntlPartsIterator
— The IntlPartsIterator class
IntlPartsIterator::getBreakIterator
— Get IntlBreakIterator backing this parts iterator
UConverter
— The UConverter class
UConverter::__construct
— Create UConverter object
UConverter::convert
— Convert string from one charset to another
UConverter::fromUCallback
— Default "from" callback function
UConverter::getAliases
— Get the aliases of the given name
UConverter::getAvailable
— Get the available canonical converter names
UConverter::getDestinationEncoding
— Get the destination encoding
UConverter::getDestinationType
— Get the destination converter type
UConverter::getErrorCode
— Get last error code on the object
UConverter::getErrorMessage
— Get last error message on the object
UConverter::getSourceEncoding
— Get the source encoding
UConverter::getSourceType
— Get the source converter type
UConverter::getStandards
— Get standards associated to converter names
UConverter::getSubstChars
— Get substitution chars
UConverter::reasonText
— Get string representation of the callback reason
UConverter::setDestinationEncoding
— Set the destination encoding
UConverter::setSourceEncoding
— Set the source encoding
UConverter::setSubstChars
— Set the substitution chars
UConverter::toUCallback
— Default "to" callback function
UConverter::transcode
— Convert a string from one character encoding to another
Grapheme Functions
grapheme_extract
— Function to extract a sequence of default grapheme clusters from a text buffer, which must be encoded in UTF-8
grapheme_stripos
— Find position (in grapheme units) of first occurrence of a case-insensitive string
grapheme_stristr
— Returns part of haystack string from the first occurrence of case-insensitive needle to the end of haystack
grapheme_strlen
— Get string length in grapheme units
grapheme_strpos
— Find position (in grapheme units) of first occurrence of a string
grapheme_strripos
— Find position (in grapheme units) of last occurrence of a case-insensitive string
grapheme_strrpos
— Find position (in grapheme units) of last occurrence of a string
grapheme_strstr
— Returns part of haystack string from the first occurrence of needle to the end of haystack
grapheme_substr
— Return part of a string
IDN Functions
idn_to_ascii
— Convert domain name to IDNA ASCII form
idn_to_utf8
— Convert domain name from IDNA ASCII to Unicode
IntlChar
— IntlChar
IntlChar::charAge
— Get the "age" of the code point
IntlChar::charDigitValue
— Get the decimal digit value of a decimal digit character
IntlChar::charDirection
— Get bidirectional category value for a code point
IntlChar::charFromName
— Find Unicode character by name and return its code point value
IntlChar::charMirror
— Get the "mirror-image" character for a code point
IntlChar::charName
— Retrieve the name of a Unicode character
IntlChar::charType
— Get the general category value for a code point
IntlChar::chr
— Return Unicode character by code point value
IntlChar::digit
— Get the decimal digit value of a code point for a given radix
IntlChar::enumCharNames
— Enumerate all assigned Unicode characters within a range
IntlChar::enumCharTypes
— Enumerate all code points with their Unicode general categories
IntlChar::foldCase
— Perform case folding on a code point
IntlChar::forDigit
— Get character representation for a given digit and radix
IntlChar::getBidiPairedBracket
— Get the paired bracket character for a code point
IntlChar::getBlockCode
— Get the Unicode allocation block containing a code point
IntlChar::getCombiningClass
— Get the combining class of a code point
IntlChar::getFC_NFKC_Closure
— Get the FC_NFKC_Closure property for a code point
IntlChar::getIntPropertyMaxValue
— Get the max value for a Unicode property
IntlChar::getIntPropertyMinValue
— Get the min value for a Unicode property
IntlChar::getIntPropertyValue
— Get the value for a Unicode property for a code point
IntlChar::getNumericValue
— Get the numeric value for a Unicode code point
IntlChar::getPropertyEnum
— Get the property constant value for a given property name
IntlChar::getPropertyName
— Get the Unicode name for a property
IntlChar::getPropertyValueEnum
— Get the property value for a given value name
IntlChar::getPropertyValueName
— Get the Unicode name for a property value
IntlChar::getUnicodeVersion
— Get the Unicode version
IntlChar::hasBinaryProperty
— Check a binary Unicode property for a code point
IntlChar::isalnum
— Check if code point is an alphanumeric character
IntlChar::isalpha
— Check if code point is a letter character
IntlChar::isbase
— Check if code point is a base character
IntlChar::isblank
— Check if code point is a "blank" or "horizontal space" character
IntlChar::iscntrl
— Check if code point is a control character
IntlChar::isdefined
— Check whether the code point is defined
IntlChar::isdigit
— Check if code point is a digit character
IntlChar::isgraph
— Check if code point is a graphic character
IntlChar::isIDIgnorable
— Check if code point is an ignorable character
IntlChar::isIDPart
— Check if code point is permissible in an identifier
IntlChar::isIDStart
— Check if code point is permissible as the first character in an identifier
IntlChar::isISOControl
— Check if code point is an ISO control code
IntlChar::isJavaIDPart
— Check if code point is permissible in a Java identifier
IntlChar::isJavaIDStart
— Check if code point is permissible as the first character in a Java identifier
IntlChar::isJavaSpaceChar
— Check if code point is a space character according to Java
IntlChar::islower
— Check if code point is a lowercase letter
IntlChar::isMirrored
— Check if code point has the Bidi_Mirrored property
IntlChar::isprint
— Check if code point is a printable character
IntlChar::ispunct
— Check if code point is punctuation character
IntlChar::isspace
— Check if code point is a space character
IntlChar::istitle
— Check if code point is a titlecase letter
IntlChar::isUAlphabetic
— Check if code point has the Alphabetic Unicode property
IntlChar::isULowercase
— Check if code point has the Lowercase Unicode property
IntlChar::isupper
— Check if code point has the general category "Lu" (uppercase letter)
IntlChar::isUUppercase
— Check if code point has the Uppercase Unicode property
IntlChar::isUWhiteSpace
— Check if code point has the White_Space Unicode property
IntlChar::isWhitespace
— Check if code point is a whitespace character according to ICU
IntlChar::isxdigit
— Check if code point is a hexadecimal digit
IntlChar::ord
— Return Unicode code point value of character
IntlChar::tolower
— Make Unicode character lowercase
IntlChar::totitle
— Make Unicode character titlecase
IntlChar::toupper
— Make Unicode character uppercase
IntlException
— Exception class for intl errors
IntlIterator
— The IntlIterator class
IntlIterator::current
— Get the current element
IntlIterator::key
— Get the current key
IntlIterator::next
— Move forward to the next element
IntlIterator::rewind
— Rewind the iterator to the first element
IntlIterator::valid
— Check if current position is valid
intl Functions
intl_error_name
— Get symbolic name for a given error code
intl_get_error_code
— Get the last error code
intl_get_error_message
— Get description of the last error
intl_is_failure
— Check whether the given error code indicates failure