加入收藏 | 设为首页 | 会员中心 | 我要投稿 安卓应用网 (https://www.0791zz.com/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > PHP > 正文

php array_search具有多个命中的单个数组

发布时间:2020-05-25 08:33:15 所属栏目:PHP 来源:互联网
导读:我正在做一个日历,可能有超过1个事件与每天的日期相匹配.目前我很困惑如何发现比第一场比赛更多的array_search.这就是我现在正在做的事情. if (array_search($date_today, $event_start) !== FALSE ) { $date_match = array_search($date_today, $event_start

我正在做一个日历,可能有超过1个事件与每天的日期相匹配.目前我很困惑如何发现比第一场比赛更多的array_search.这就是我现在正在做的事情.

if (array_search($date_today,$event_start) !== FALSE ) {
     $date_match = array_search($date_today,$event_start);
     $name       = $event_name[$date_match];    
   }

我可以使用’while’或’for each’语句推进array_search以查找多个匹配项吗?如果重要的是我的日期变量是日期,如1368680400.

Documentation for array_search告诉我们:

If needle is found in haystack more than once,the first matching key is returned. To return the keys for all matching values,use array_keys() with the optional search_value parameter instead.

(编辑:安卓应用网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读