Wordpress. Is there a code <?php echo get_post_meta($post->ID, 'wpcf-house_price', true) ?> руб. that displays the price of the object. How to use number_format() format a number? 2 decimals and thousands separator space.
2 answers
<?php echo number_format(get_post_meta($post->ID, 'wpcf-house_price', true), 2, ',', ' '); ?> руб. - there was a thought that such a recording might work, but for some reason I thought it would be too easy. It worked, thanks. - malginovdesign
|
Try, for example, like this:
$num = number_format($number, 2, ',', ' '); // 1 234,56 - logically, I understand what and how to try. I have a problem with the syntax, could you tell me to write the full code? - malginovdesign
|