I have the following code to filter an array ib php. It works fine. After adding more filtering conditions, it doesn't work. Can anyone tell what might have gone wrong?
Code that works
$s_item = array_values(array_filter($itmlist, function ($itmlist) { return ($itmlist['itmslsprc'] > 0); } ));
Code doesn't work after adding more conditions
$s_item = array_values(array_filter($itmlist, function ($itmlist) { return ($itmlist['itmslsprc'] > 0 && $today >= $itmlist['itmslsfr'] && $today <= $itmlist['itmslsto']); } ));
Both $today and other dates are in format 2021-01-12 00:00:00 format. Thanks in advance for any advice.
https://stackoverflow.com/questions/65839167/php-array-filter-with-multiple-condition January 22, 2021 at 12:06PM
没有评论:
发表评论