I18N_Arabic

# Procedural File: Numbers.php Source Location: /Arabic/Numbers.php ## Classes: I18N_Arabic_Numbers This PHP class spell numbers in the Arabic idiom ## Page Details: ---------------------------------------------------------------------- Copyright (c) 2006-2016 Khaled Al-Sham'aa. http://www.ar-php.org PHP Version 5 ---------------------------------------------------------------------- LICENSE This program is open source product; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License (LGPL) as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see <http://www.gnu.org/licenses/lgpl.txt>. ---------------------------------------------------------------------- Class Name: Spell numbers in the Arabic idiom Filename: Numbers.php Original Author(s): Khaled Al-Sham'aa <khaled@ar-php.org> Purpose: Spell numbers in the Arabic idiom ---------------------------------------------------------------------- Spell numbers in the Arabic idiom PHP class to spell numbers in the Arabic idiom. This function is very useful for financial applications in Arabic for example. If you ever have to create an Arabic PHP application built around invoicing or accounting, you might find this class 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. This class will accept almost any numeric value and convert it into an equivalent string of words in written Arabic language (using Windows-1256 character set). The value can be any positive number up to 999,999,999 (users should not use commas). It will take care of feminine and Arabic grammar rules. Example: include('./I18N/Arabic.php'); $obj = new I18N_Arabic('Numbers'); $obj->setFeminine(1); $obj->setFormat(1); $integer = 2147483647; $text = $obj->int2str($integer); echo "<p align=\"right\"><b class=hilight>$integer</b><br />$text</p>"; $obj->setFeminine(2); $obj->setFormat(2); $integer = 2147483647; $text = $obj->int2str($integer); echo "<p align=\"right\"><b class=hilight>$integer</b><br />$text</p>"; #### Tags:
author: | Khaled Al-Sham'aa <khaled@ar-php.org>
copyright: | 2006-2016 Khaled Al-Sham'aa
link: | http://www.ar-php.org
filesource: | Source Code for this file
license: | LGPL
Documentation generated on Fri, 01 Jan 2016 10:26:12 +0200 by phpDocumentor 1.4.0