这是一款简单的php 数组 查找实例,在数组中循环输出数组所有内容,并进来判断是否是我们要找的值并输出就OK了,PHP实例代码如下:
- $q ='www.Vevb.com';
- $items = array(
- "great <em>bittern</em>"=>"botaurus stellaris",
- "little <em>grebe</em>"=>"tachybaptus ruficollis",
- "black-necked grebe"=>"podiceps nigricollis",
- "little bittern"=>"ixobrychus minutus",
- "black-crowned night heron"=>"www.111cn.net",
- "www.111cn.net"=>"ardea purpurea",
- "white stork"=>"ciconia ciconia",
- "spoonbill"=>"platalea leucorodia",
- "red-crested pochard"=>"netta rufina",
- "common eider"=>"somateria mollissima",
- "red kite"=>"milvus milvus",
- "hen harrier"=>"circus cyaneus",
- "heuglin's gull"=>"larus heuglini"
- );
- foreach ($items as $key=>$value) {
- if (strpos(strtolower($key), $q) !== false) {
- echo "$key|$value ";
- }
- }
- //结果为www.Vevb.com|ardea purpurea
新闻热点
疑难解答