vangilsweb Posted August 22, 2011 Share Posted August 22, 2011 Is there an alternative for the following function? <?php if ($products->count()>0):?> This function causes long loading time. Is there an alternative, for we only want to know if $products contains products, not the number of products. Quote Link to comment https://forums.phpfreaks.com/topic/245418-count-function/ Share on other sites More sharing options...
vangilsweb Posted August 22, 2011 Author Share Posted August 22, 2011 solved it like this: instead of: <?php if ($products->count()>0):?> [i]code...[/i] use this: <?php if (!$products->count()):?> [i]no code...[/i] <?php else : ?> [i]code...[/i] Quote Link to comment https://forums.phpfreaks.com/topic/245418-count-function/#findComment-1260473 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.