Skip to content
Advertisement

PHP thousand separator formatting for generated page from xlsx

Ty mail2bapi, ๐Ÿ™‚

Im using SimpleXLSX and example script below in code i added this $x = number_format($r);

Just need the numbers to have thousand separator 252252732 to 252,252,732

IM not good with PHP, really appreciate any help

Plus some columns are empty and dates like so 23.01.2020, I think this is what is causing the issue

XMLS File simplexlsx

Error: number_format() expects parameter 1 to be double, array given in

Error: implode(): Invalid arguments passed

JavaScript

Advertisement

Answer

You are not using number_format() function correctly. Change following code from โ€“

JavaScript

to

JavaScript

for more information visit PHP number_format

EDIT

As you mentioned your row could have a different type of values, it is better to check the value for numeric.

Try this code

JavaScript

Hope these resolve your issue.

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement