Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
101 changes: 101 additions & 0 deletions reference/intl/locale/isrighttoleft.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="locale.isrighttoleft"
xmlns="http://docbook.org/ns/docbook"
xmlns:xlink="http://www.w3.org/1999/xlink">

<refnamediv>
<refname>Locale::isRightToLeft</refname>
<refpurpose>Check whether a locale uses a right-to-left writing system</refpurpose>
</refnamediv>

<refsect1 role="description">
&reftitle.description;

<para>
&style.oop;
</para>

<methodsynopsis role="Locale">
<modifier>public</modifier>
<modifier>static</modifier>
<type>bool</type>
<methodname>Locale::isRightToLeft</methodname>
<methodparam choice="opt">
<type>string</type><parameter>locale</parameter>
<initializer>""</initializer>
</methodparam>
</methodsynopsis>

<para>
Determines whether a locale uses a right-to-left writing system.
</para>

<para>
This method relies on the ICU library and evaluates the dominant script
associated with the locale.
</para>

<para>
If an empty string is provided, the default locale is used.
</para>
</refsect1>

<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>locale</parameter></term>
<listitem>
<para>
The locale identifier. If empty, the default locale is used.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>

<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns <constant>true</constant> if the locale uses a right-to-left
writing system, or <constant>false</constant> otherwise.
</para>
</refsect1>

<refsect1 role="changelog">
&reftitle.changelog;
<informaltable>
<tgroup cols="2">
<thead>
<row>
<entry>&Version;</entry>
<entry>&Description;</entry>
</row>
</thead>
<tbody>
<row>
<entry>PHP 8.5.0</entry>
<entry>
Added <methodname>Locale::isRightToLeft</methodname>.
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</refsect1>

<refsect1 role="examples">
&reftitle.examples;
<example>
<title>Checking text direction for a locale</title>
<programlisting><![CDATA[
var_dump(Locale::isRightToLeft('en-US')); // bool(false)
var_dump(Locale::isRightToLeft('ar')); // bool(true)
]]></programlisting>
</example>
</refsect1>

</refentry>