判断数组元素位置我们可以使用array_keys函数与foreach对比来实现.
array_keys的语法如下:
array_keys(array,value,[strict])
其中strict设置为true将触发数据类型校验的严格匹配模式,默认为false,下边的代码展示了array_keys的一个简单应用,代码如下:
- <?php
- $test=array(10,20,30,"10","20","30");
- print_r(array_keys($test,"10",true));//严格匹配模式
- //输出:
- //Array ( [0] => 3)
- ?>
当然我们还可以使用 foreach 加判断了,代码如下:
- $one = array(1, 2, 3, 4);
- $two = array("test1" =>array('name'=>"tank","phone"=>12412433),
- "test2" => array('name'=>"ying","phone"=>252523523),
- "test3" => array('name'=>"zhang","phone"=>656452345),);
- foreach ($one as $k=>$v) {
- echo "key=".$k."&value=".$v."<br>";
- }
- $i=0;
- foreach ($two as $k=>$v) {
- foreach($v as $value){
- if( $v='tank' )
- {
- echo $i;
- }
- $i++;
- }
- }
后面这个是利用遍历数组然后加一值的对比就可以判断出来了.
波比源码 – 精品源码模版分享 | www.bobi11.com
1. 本站所有资源来源于用户上传和网络,如有侵权请邮件联系站长!
2. 分享目的仅供大家学习和交流,您必须在下载后24小时内删除!
3. 不得使用于非法商业用途,不得违反国家法律。否则后果自负!
4. 本站提供的源码、模板、插件等等其他资源,都不包含技术服务请大家谅解!
5. 如有链接无法下载、失效或广告,请联系管理员处理!
6. 本站资源售价只是赞助,收取费用仅维持本站的日常运营所需!
7. 本站源码并不保证全部能正常使用,仅供有技术基础的人学习研究,请谨慎下载
8. 如遇到加密压缩包,请使用WINRAR解压,如遇到无法解压的请联系管理员!
波比源码 » PHP获取数组中某元素的位置实例
波比源码 » PHP获取数组中某元素的位置实例
buy levofloxacin 500mg without prescription levaquin brand
buy dutasteride pills purchase celecoxib online cheap buy zofran 4mg
sildenafil oral order sildenafil 50mg sale estradiol for sale online
order lamictal pill lamictal 50mg tablet buy retin
order indomethacin 50mg generic buy lamisil 250mg sale order amoxicillin generic
arimidex 1mg for sale overnight delivery of viagra viagra 100mg canada
acheter 5mg du cialis cialis 10mg prix sildenafil 25mg pas cher
order generic provigil acetazolamide 250 mg pills buy generic acetazolamide 250 mg
order clonidine generic order antivert 25mg for sale tiotropium bromide 9mcg uk
alendronate usa buy motrin 400mg online cheap order famotidine sale
order tacrolimus buy labetalol 100mg brand urso 150mg
imdur 40mg canada buy digoxin 2250 mg without prescription purchase micardis online
purchase zoloft pill sildenafil 200mg oral brand viagra
revia online buy buy albenza buy aripiprazole 20mg pills
fluvoxamine 50mg for sale luvox 100mg canada glipizide cost
isotretinoin 20mg usa amoxicillin 500mg pills deltasone 10mg without prescription
azithromycin ca order prednisolone pills neurontin online buy
cialis 10mg usa anafranil 25mg canada order clomipramine 25mg
buy chloroquine generic order olumiant generic order olumiant 4mg online cheap
sporanox usa sporanox 100mg drug tinidazole 300mg for sale
order glycomet 1000mg sale atorvastatin 20mg ca cialis from canada
olanzapine pill buy diovan 80mg cheap diovan 80mg
cialis us order tadalafil without prescription viagra sale
aristocort 10mg for sale purchase desloratadine for sale purchase desloratadine sale
buy priligy 30mg generic misoprostol tablet oral synthroid
buy tadalafil 40mg generic tadalafil 40mg canada sildenafil in usa
tadalafil online buy inderal 20mg online clopidogrel 75mg cheap
sumatriptan 50mg tablet levaquin price order avodart 0.5mg pill
colchicine 0.5mg uk play slots for real money united states poker game
free casino play blackjack online for real money poker game
order generic flagyl bactrim buy online order bactrim 960mg for sale
purchase fluconazole generic viagra 100 mg sildenafil 200 mg
cephalexin 500mg sale brand erythromycin 500mg order erythromycin 250mg generic
sildenafil pill order estrace 1mg generic lamotrigine
buy deltasone 10mg for sale accutane sale buy amoxicillin 500mg without prescription
azithromycin for sale neurontin sale cheap neurontin generic
free online blackjack casino game real cialis pharmacy prescription
online casino slots no download provigil online buy modafinil ca
deltasone 10mg cost order deltasone online purchase mebendazole online
retin buy online retin cream sale buy avana 100mg without prescription
order tiotropium bromide without prescription purchase minocycline online cheap hytrin us
order cialis 5mg online casino bonus win real money online casino
generic adalat 10mg purchase adalat pill cost fexofenadine
casino online games for real money writing dissertation service pre written essays for sale
purchase altace pill etoricoxib pills arcoxia over the counter
academic writing terms buying a term paper buy sulfasalazine 500 mg pills
buy mesalamine 400mg for sale purchase mesalamine pills irbesartan ca
diamox pills diamox 250 mg uk buy azathioprine for sale
order generic lanoxin 250mg purchase micardis sale molnunat 200mg ca
order generic alendronate 70mg buy motrin 600mg generic ibuprofen 400mg usa
dapoxetine 60mg tablet order generic avanafil domperidone for sale
indomethacin 50mg cheap cenforce usa brand cenforce 100mg
generic pepcid 40mg mirtazapine buy online remeron sale
order doxycycline 200mg generic medrol canada methylprednisolone 16mg over the counter
Hi, just required you to know I he added your site to my Google bookmarks due to your layout. But seriously, I believe your internet site has 1 in the freshest theme I??ve came across.Metropol Halı Karaca Halı Öztekin ve Selçuklu Halı Cami Halısı ve Cami Halıları Türkiye’nin En Büyük Cami Halısı Fabrikasıyız…
tricor 160mg generic fenofibrate drug viagra 100mg us
After all, what a great site and informative posts, I will upload inbound link – bookmark this web site? Regards, Reader. Metropol Halı Karaca Halı Öztekin ve Selçuklu Halı Cami Halısı ve Cami Halıları Türkiye’nin En Büyük Cami Halısı Fabrikasıyız…
brand minocycline generic gabapentin 800mg buy hytrin 5mg pill
deltasone 5mg ca amoxicillin 500mg usa amoxicillin 500mg sale
ivermectin 12mg tablets for humans stromectol pills order prednisone 5mg pill