Spell Numbers in the Arabic Idiom:

Spell numbers in the Arabic idiom. This function is very useful for e-Commerce applications in Arabic for example. It accepts almost any numeric value and convert it into an equivalent string of words in written Arabic language and take care of feminine and Arabic grammar rules.

If you ever have to create an Arabic PHP application built around invoicing or accounting, you might find this method useful. Its sole reason for existence is to help you translate integers into their spoken-word equivalents in Arabic language.How is this useful? Well, consider the typical invoice: In addition to a description of the work done, the date, and the hourly or project cost, it always includes a total cost at the end, the amount that the customer is expected to pay. To avoid any misinterpretation of the total amount, many organizations (mine included) put the amount in both words and figures; for example, $1,200 becomes "one thousand and two hundred dollars." You probably do the same thing every time you write a check.

Now take this scenario to a Web-based invoicing system. The actual data used to generate the invoice will be stored in a database as integers, both to save space and to simplify calculations. So when a printable invoice is generated, your Web application will need to convert those integers into words, this is more clarity and more personality.


Example Output 1: المعدود مذكر مرفوع

setNumberFeminine(1); $Arabic->setNumberFormat(1); $integer = 141592653589; $text = $Arabic->int2str($integer); echo "
$integer
$text
"; ?>

Example Code 1:

setNumberFeminine(1); \$Arabic->setNumberFormat(1); \$integer = 141592653589; \$text = \$Arabic->int2str(\$integer); echo "
\$integer
\$text
"; END; highlight_string($code); ?>
Related Documentation: setNumberFeminine, setNumberFormat, int2str

Example Output 2: المعدود مؤنث منصوب أو مجرور

setNumberFeminine(2); $Arabic->setNumberFormat(2); $integer = 141592653589; $text = $Arabic->int2str($integer); echo "
$integer
$text
"; ?>

Example Code 2:

setNumberFeminine(2); \$Arabic->setNumberFormat(2); \$integer = 141592653589; \$text = \$Arabic->int2str(\$integer); echo "
\$integer
\$text
"; END; highlight_string($code); ?>
Related Documentation: setNumberFeminine, setNumberFormat, int2str

Example Output 3: المعدود مؤنث منصوب أو مجرور وهو سالب بفاصلة عشرية

setNumberFeminine(2); $Arabic->setNumberFormat(2); $integer = '-2749.317'; $text = $Arabic->int2str($integer); echo "

$integer
$text

"; ?>

Example Code 3:

setNumberFeminine(2); \$Arabic->setNumberFormat(2); \$integer = '-2749.317'; \$text = \$Arabic->int2str(\$integer); echo "

\$integer
\$text

"; END; highlight_string($code); ?>
Related Documentation: setNumberFeminine, setNumberFormat, int2str

Example Output 4: العملات العربية

setNumberFeminine(1); $Arabic->setNumberFormat(1); $number = 7.25; $text = $Arabic->money2str($number, 'KWD', 'ar'); echo "

$number
$text

"; ?>

Example Code 4:

setNumberFeminine(1); \$Arabic->setNumberFormat(1); \$number = 7.25; \$text = \$Arabic->money2str(\$number, 'KWD', 'ar'); echo "

\$number
\$text

"; END; highlight_string($code); ?>
Related Documentation: setNumberFeminine, setNumberFormat, money2str

Example Output 5: صيغ الجمع

arPlural('تعليق', $number); $text = str_replace('%d', $number, $text); echo "

$text

"; $number = 16; $text = $Arabic->arPlural('صندوق', $number, 'صندوقان', 'صناديق', 'صندوقا'); $text = str_replace('%d', $number, $text); echo "

$text

"; ?>

Example Code 5:

arPlural('تعليق', \$number); \$text = str_replace('%d', \$number, \$text); echo "

\$text

"; \$number = 16; \$text = \$Arabic->arPlural('صندوق', \$number, 'صندوقان', 'صناديق', 'صندوقا'); \$text = str_replace('%d', \$number, \$text); echo "

\$text

"; END; highlight_string($code); ?>
Related Documentation: arPlural

Example Output 6: الأرقام الهندية

int2indic($text1); echo "

$text1
$text2

"; ?>

Example Code 6:

int2indic(\$text1); echo "

\$text1
\$text2

"; END; highlight_string($code); ?>
Related Documentation: int2indic

Example Output 7: ترتيب لمعدود مؤنث منصوب أو مجرور

setNumberFeminine(2); $Arabic->setNumberFormat(2); $Arabic->setNumberOrder(2); $integer = '17'; $text = $Arabic->int2str($integer); echo "

$integer
$text

"; ?>

Example Code 7:

setNumberFeminine(2); \$Arabic->setNumberFormat(2); \$Arabic->setNumberOrder(2); \$integer = '17'; \$text = \$Arabic->int2str(\$integer); echo "

\$integer
\$text

"; END; highlight_string($code); ?>
Related Documentation: setNumberFeminine, setNumberFormat, setNumberOrder, int2str

Example Output 8: تحويل الرقم المكتوب إلى عدد صحيح من جديد

str2int($string); echo "

$string
$integer

"; ?>

Example Code 8:

str2int(\$string); echo "

\$string
\$integer

"; END; highlight_string($code); ?>
Related Documentation: str2int