FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » Problem with Populating Persian(Arabic) Number in PHP
Show: Today's Messages :: Polls :: Message Navigator
Switch to threaded view of this topic Create a new topic Submit Reply
Problem with Populating Persian(Arabic) Number in PHP [message #175853] Mon, 31 October 2011 07:25 Go to next message
beh is currently offline  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 Go to previous message
alvaro.NOSPAMTHANX is currently offline  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
--
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Stats comp.lang.php (last 7 days)
Next Topic: json and special chars
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sat Nov 09 01:00:08 GMT 2024

Total time taken to generate the page: 0.02796 seconds