I have a JSON array and in that I have 3 JSON objects. I want to count the number of objects that is 3. but it is giving me 1. If I do not add the key "like
", then it works. but after adding it, it is not working.
$JSON = '{"like":['
. '{"username":"suraj","password":"abc"},'
. '{"username":"don","password":"abc"},'
. '{"username":"rana","password":"abc"}'
. ']}';
$jsonInPHP = json_decode($JSON);
echo count($jsonInPHP);