I have a php script that echoes the view count of a Youtube video using the Youtube API. However, I would like it to add commas when reaching views in the thousands and over.
My code is below:
$JSON = file_get_contents('https://gdata.youtube.com/feeds/api/videos/XQu8TTBmGhA?v=2&alt=json');
$JSON_Data = json_decode($JSON);
$views = $JSON_Data->{'entry'}->{'yt$statistics'}->{'viewCount'};
echo $views;
Any help would be highly appreciated!