How to get Youtube Subscriber Count Using PHP

You may be facing some situations in wordpress to display the total count of youtube subscribers, you can use the below code for display the youtube subscribers count.

echo $youtube_subscriber_count = json_decode(file_get_contents(''))->entry->{'yt$statistics'}->subscriberCount;

if you are looking for a function, don’t be afraid.

function getYouTubeSubscribers($channel, $stat = 'subscriberCount')
  return json_decode(file_get_contents('' . $channel . '?v=2&alt=json'))->entry->{'yt$statistics'}->$stat;

Total Video Views:
echo getYouTubeVideoViews('anandmahalakshmi');