skip to Main Content

How to iterate an array to count elements PHP?

I wanna know how to iterate an array to count elements in PHP, I've trying next, foreach ($items as $item) { $tm[$item->provider->name] = []; foreach ($items as $item) { $tm[$item->provider->name][$item->product->brand->name] = isset($tm[$item->provider->name][$item->product->brand->name]) ? $tm[$item->provider->name][$item->product->brand->name] + 1 : $tm[$item->provider->name][$item->product->brand->name] = 1;…

VIEW QUESTION

How to get value from associative json in shopify liquid

{"collections"=>{"1656046380"=>[{"collection_title"=>"sport"}, {"question"=>"q_0", "answer"=>"a_0"}, {"question"=>"q_1", "answer"=>"a_1"}, {"question"=>"q_2", "answer"=>"a_2"}], "1656047118"=>[{"collection_title"=>"cars"}, {"question"=>"q_0", "answer"=>"a_0"}, {"question"=>"q_1", "answer"=>"a_1"}, {"question"=>"q_2", "answer"=>"a_2"}]}, "group"=>{"1656046878"=>[{"group_title"=>"page1"}, {"style"=>"3"}, {"selected_coll"=>"["1656046380","1656046423"]"}]}} If this is my data which I am getting using liquid for loop {%- for field in shop.metafields.advance_faq_app -%} <li>{{ shop.metafields.advance_faq_app.advance_faq_app }}</li><br/> {%-…

VIEW QUESTION
Back To Top
Search