Add dollar sign and commas to a number?

To format number, you can use the function number_format_i18n (it’s not documented now, but you can see its source here). Its work is format the number based on the language. You might want to look at number_format (PHP built_in function, and is used by number_format_i18n) to have more control to decimal point and thousand separator.

In your case, this code will help you:

$meta = get_post_meta(get_the_ID(), 'rw_propPrice', true);
echo '$' . number_format($meta, 0, '.', ',');

Leave a Comment