ImYourCousin Posted July 11, 2018 Share Posted July 11, 2018 Hi guys. I want count same string values on a JSON file. It looks like below. { "131": { "uyeid": "170", ... }, "71": { "uyeid": "170", ... }, "148": { "kurumid": "171", ... ... I get this content with below code $icerik = file_get_contents("json.php"); $veri = json_decode($icerik, true); I want count uyeid values in this json file.Is that possible? Link to comment Share on other sites More sharing options...
Barand Posted July 11, 2018 Share Posted July 11, 2018 $veri = [ 131 => ['uyeid' => 170], 71 => ['uyeid' => 170], 148 => ['kurumid' => 171] ]; $uyeid_count = count(array_filter($veri, function($v) { return isset($v['uyeid']); })); echo $uyeid_count; //--> 2 Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.