php数组函数之搜索关联数组的值array_search

时间:2026-02-12 23:12:56

1、初始化关联数组:<?php

                                    $arr=array('A'=>'I','B'=>'DI','C'=>'GIS');

2、用array_search函数搜索,$founded=array_search('DI',$arr);

3、用if判断输出:if($founded){

                                  echo $founded,'找到了';

                      }else{

                          echo '没找到';

                    }

4、结果如图:

php数组函数之搜索关联数组的值array_search

© 2026 一点资料
信息来自网络 所有数据仅供参考
有疑问请联系站长 site.kefu@gmail.com