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 7399199
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T04:01:41+00:00 2026-05-29T04:01:41+00:00

Hello everyone i am trying to format the input number range with php number_format

  • 0

Hello everyone i am trying to format the input number range with php number_format

INPUT Probability

  1. 1234
  2. 12345
  3. 123456789
  4. 123456789,50
  5. 123.45,00
  6. 123.456.78,50

OUTPUT should be

dot should be in multiplier of 3 digit and last two (if available in input range) digits should be come with comma separater

  1. 1.234,00
  2. 12.345,00
  3. 123.456.789,00
  4. 123.456.789,50
  5. 12.345,00
  6. 12.345.678,50

out put should be as per dutch format and dot should be in multiplier of 3 digit and last two digits should be come with comma separater

like, here is link you can put any input value from above list in textbox you can get output like shown below

the code which i am using

echo numberFormat('12345');

function numberFormat($num)
{
     return preg_replace("/(?<=\d)(?=(\d{3})+(?!\d))/",".",$num);
}

but it will not work with (4),(5),(6) from my input probability to match with outputs.

  • 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-05-29T04:01:41+00:00Added an answer on May 29, 2026 at 4:01 am

    Well I think is like this:

    $number = 1234.56
    echo number_format($number, 2, ',', '.');
    

    About the input yo could check and all the “.” remove it and the “,” replace with “.”

    $number = "123.456,78";
    $temp = str_replace(".", "", $number);
    $temp2 = str_replace(",", ".", $temp);
    echo number_format($temp2, 2, ',', '.');
    

    I hope it helps

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

Sidebar

Related Questions

Hello everyone I been trying get php uploader working but having a lot of
Hello everyone I am trying to resize an image of 700kb with imagecreatefromjpeg. This
Hello everyone I'm trying to work with jboss messaging, does anyone knows the default
Hello everyone I'm trying to improve my Java skills by solving some problems from
Hello everyone Masters Of Web Delevopment :) I have a piece of PHP script
Hello everyone this is my first post on stack overflow.com I am trying to
Hello everyone iam trying to open a aspx page in a dialog box window
Hello everyone, I'm developing a photo sharing web site using the CodeIgniter PHP framework
hello everyone I'm trying to write function which can unfold int in the list
hello everyone I'm trying to understand how 2-3 trees work, I understood a concept

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.