How to change format number in PHP

Viewed 159

I have the following views count function for wordpress post. However, the number that comes up is for example 2000, while I'm trying to get 2.000.

Located in Functions.php

add_action ('elementor/query/popular_post', function ($query) {
    $query->set('orderby', 'meta_value_num');
    $query->set('meta_key', 'views');
});

Located in Header.php

<?php
if (is_singular('post')) {
    $count = get_field('views');
    $count ++;
    update_field('views', $count);
}
?>

I tried googling and changed the code several times but couldn't change the format of the numbers. Would anyone be kind enough to give a Tips?

I'm sorry for not being able to replicate the function in JsFiddle or similar, but I believe this is not possible.

I don't know php, I'm a fan.

2 Answers
Related