I\'ve got this in my Laravel webapp:
@foreach($mentors as $mentor)
@foreach($mentor->intern as $intern)
-
This is the fastest way:
if ($coll->isEmpty()) {...}
Other solutions like count
do a bit more than you need which costs slightly more time.
Plus, the isEmpty()
name quite precisely describes what you want to check there so your code will be more readable.
讨论(0)
- 热议问题