-
-
Notifications
You must be signed in to change notification settings - Fork 946
Closed
Description
The playground is broken, so the raw code:
$someVar = 'now';
$uppedDate = new DateTime($someVar);
$diff = $uppedDate->diff(new DateTime());
$mdiff = (int)$diff->format('%m');
$ddiff = (int)$diff->format('%d');
$content = array_filter([$mdiff, $ddiff]);
// if condition is always true
if ($content) {
die();
}
// the error is gone
if (\count($content) > 0) {
die();
}
$content = array_filter([$mdiff, $ddiff], fn(): bool => false);
// the error is gone
if ($content) {
die();
}- array_filter w/ empty callback might return an empty array
- why
count()ing the result removes the error?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels