Home »
Imported messages »
comp.lang.php »
Problem with Populating Persian(Arabic) Number in PHP
Problem with Populating Persian(Arabic) Number in PHP [message #175853] |
Mon, 31 October 2011 07:25 |
beh
Messages: 1 Registered: October 2011
Karma: 0
|
Junior Member |
|
|
Hi everyone,
Can you please let me know why I am getting error on populating
Persian(Arabic)Numbers?!
I have saved the php file as "Uncode in UTF-8" format which can
display the dropdown list in a HTML correctly but when I want to
retrieve them in PHP I encountered with following errors
Errors:
(!) Notice: Use of undefined constant ١ - assumed '١' in C:\wamp\www
\PHPCode\Test.php on line 14
(!) Notice: Use of undefined constant ٣١ - assumed '٣١' in C:\wamp\www
\PHPCode\Test.php on line 14
* ١ = is a Persian number equal to 1
* ٣١ = is a Persian number equal to 31
Code:
<?php
$numberArray = array();
for ($i = ١; $i < ٣١; $i++)
{
$numberArray[] = $i;
}
for ($i = 0; $i < sizeof($numberArray); $i++) {
echo "$numberArray[$i]"."<br />";
}
?>
I really appreciate your time regarding this.
|
|
|
Re: Problem with Populating Persian(Arabic) Number in PHP [message #175854 is a reply to message #175853] |
Mon, 31 October 2011 08:30 |
alvaro.NOSPAMTHANX
Messages: 277 Registered: September 2010
Karma: 0
|
Senior Member |
|
|
El 31/10/2011 8:25, beh escribió/wrote:
> Can you please let me know why I am getting error on populating
> Persian(Arabic)Numbers?!
> I have saved the php file as "Uncode in UTF-8" format which can
> display the dropdown list in a HTML correctly but when I want to
> retrieve them in PHP I encountered with following errors
> Errors:
> (!) Notice: Use of undefined constant ١ - assumed '١' in C:\wamp\www
> \PHPCode\Test.php on line 14
> (!) Notice: Use of undefined constant ٣١ - assumed '٣١' in C:\wamp\www
> \PHPCode\Test.php on line 14
> * ١ = is a Persian number equal to 1
> * ٣١ = is a Persian number equal to 31
> Code:
>
> <?php
> $numberArray = array();
>
> for ($i = ١; $i< ٣١; $i++)
> {
> $numberArray[] = $i;
> }
> for ($i = 0; $i< sizeof($numberArray); $i++) {
> echo "$numberArray[$i]"."<br />";
> }
> ?>
>
> I really appreciate your time regarding this.
PHP (as most other computer languages out there) expects English
numbers, period. You can perform calculations with other type of numbers
more than you can translate "while()" or "for()" into other languages.
You can't even use comma as decimal separator. It's simply how the
syntax language has been defined.
--
-- http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
-- Mi sitio sobre programación web: http://borrame.com
-- Mi web de humor satinado: http://www.demogracia.com
--
|
|
|
Goto Forum:
Current Time: Thu Nov 28 18:38:26 GMT 2024
Total time taken to generate the page: 0.02457 seconds