Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8573289
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T19:12:56+00:00 2026-06-11T19:12:56+00:00

while developing one of my sites, i noticed that if I enter arabic numbers

  • 0

while developing one of my sites, i noticed that if I enter arabic numbers (١٢٣), they are not interpreted as real number values. Then, I tested a few other sites only to find that they also don’t accept arabic numbers.

The problem is, my client seems to require this functionality (accepting arabic numbers).. and I have no idea where to start. My platform is magento (php).

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T19:12:57+00:00Added an answer on June 11, 2026 at 7:12 pm

    To allow PHP to accept the Arabic numbers or Persian numbers (Farsi) (١٢٣٤٥),
    I developed this easy function:

    <?php
    
    /*
    /////////////////////
    This function has been created by Abdulfattah alhazmi
    Roles:
    To convert Arabic/Farsi Numbers (٠‎ - ١‎ - ٢‎ - ٣‎ - ٤‎ - ٥‎ - ٦‎ - ٧‎ - ٨‎ - ٩‎) 
    TO the corrosponding English numbers (0-1-2-3-4-5-6-7-8-9)
    http://hazmi.co.cc
    /////////////////////
    */
    
    function convertArabicNumbers($arabic) {
        $trans = array(
            "&#1632;" => "0",
            "&#1633;" => "1",
            "&#1634;" => "2",
            "&#1635;" => "3",
            "&#1636;" => "4",
            "&#1637;" => "5",
            "&#1638;" => "6",
            "&#1639;" => "7",
            "&#1640;" => "8",
            "&#1641;" => "9",
        );
        return strtr($arabic, $trans);
    }
    ?>
    

    Note: TO GET THE CORRECT RESULT from text field in your form, you have to use the htmlspecialchars_decode() function. For example:

    $mytext = htmlspecialchars_decode($_POST['mytext']));
    $mytext = convertArabicNumbers($mytext);
    

    To keep your code safe, add strip_tags(). For example:

    $mytext = strip_tags(htmlspecialchars_decode($_POST['mytext']));
    $mytext = convertArabicNumbers($mytext);
    

    Please don’t hesitate to ask me if you have any further question about this function.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've noticed an issue while developing my pages that's always bothered me: while Firefox
In a multiplayer game I'm developing, we have a few values that are floating
Hi while developing one of my web application i am storing the user information
How should one go about setting up seed data while developing an nhibernate web
How to disable Save As dialog while pressing Ctrl+S Description: I am developing one
I am following one book tutorial. While developing it, I come across a typical
I am developing a site that will allow for users to track sales numbers
While developing an application using gwt in ecliplse crashed. Now the server is running
While developing an application this is what i did : 1.Kept 320*480 as my
While developing a firefox extension, I create a wizard window from overlay.js using: this.wizard

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.