Instead of using
count() function, consider using PHP's built-in function
func_num_args() to count number of arguments of the function.
This is a micro-optimization. Apply it in case of intensive usage.
One or more compute intensive functions like
count, database calls(
mysqli_fetch_assoc, etc.) is being used in the loop condition.
Though using these functions is a cheap operation; however, there's still the function call overhead when calling it on each iteration.