Is there a better alternative to array_filter and mapping in php?

99封情书 提交于 2021-01-29 08:36:40

问题


is there a better alternative to this code

$datfrm = '01/01/2000'
$datto = '01/01/2002'

$place_map = ['best' => 1, 'better' => 0.8, 'good' => 0.6];

e1 ='good,better,best' 
e2 = 'best,better,good'
 
d1='01/01/2000,01/01/2001,01/01/2002'
d2='01/01/2001,01/01/2002,01/01/2003'
    
$dresult = array_filter($dview, function($data_item) use($datfrm,$datto) {
        return $data_item >= $datfrm && $data_item <= $datto;
    });

    $eresult = array_intersect_key($efind, $dresult);

I'm trying a date range and it's not mapping to each other and i want to sum the total result

来源:https://stackoverflow.com/questions/62813269/is-there-a-better-alternative-to-array-filter-and-mapping-in-php

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!