You are here:

PHP5/Number format issue in cron


Its a strange issue for me,

When I run a PHP script through CLI, eg : 'php filename.php'

and filename.php contains <?php $number=1.25; echo $number; ?>

it gives me output as "1,25"(see the comma) expected result was "1.25" .

and when I Run the script like "wget"
it gives correct out put ie 1.25

Our server hosted in spain and number format in spain is different.

But I dont know how and where to change config settings.
Can you Please explain.?


Hello bejoy,
         It seems that your locale has been set to dutch. So, you are getting comma(s), instead of dot(s).

So, you must first set your locale to "US" format. To do so, just use the following format.


So, your entire program should look like,

echo $number;

In future, please do think twice, if you are setting your locale to "Dutch", as it might result in unwanted conversions.

Hope this resolves your issue.

Don't hesitate to write back to me for clarifications.

All the very best and good luck.


All Answers

Answers by Expert:

Ask Experts


Vimal Abraham


I can be able to solve PHP, MySQL and Web Hosting (Linux) related issues that may include cPanel/WHM.


I have worked under various domains of web development including file sharing, social community, wallpaper management, image hosting, web hosting automation, shopping cart and payment gateway integration. My active portfolios include,

I have completed Bachelor of Engineering in Computer Science.

Awards and Honors
Have a Total of nine certificates in Inter and Intra College Competitions that includes technical quiz, program debugging and paper presentation (State Level).

©2016 All rights reserved.