PWaddict Posted October 26, 2018 Share Posted October 26, 2018 How to check if ALL elements inside foreach have this: $pp->my_field == '3' ? foreach ($items as $p) { $pp = $this->pages->get($p->product_id); if ($pp instanceof RepeaterPage) $pp = $pp->getForPage(); } Link to comment Share on other sites More sharing options...
Robin S Posted October 26, 2018 Share Posted October 26, 2018 $all_match = true; foreach($items as $p) { $pp = $this->pages->get($p->product_id); if($pp instanceof RepeaterPage) $pp = $pp->getForPage(); if($pp->my_field != '3') { $all_match = false; break; } } // do something according to the value of $all_match 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now