在php中像数组中添加元素比较常见的是array_push函数,即数组的入栈操作,但是这个函数是将元素添加到数组的末尾,如果需要将数组元素压入到数组的头部(即第一个元素)该如何操作呢?
使用php内置函数 array_unshift,下面就将 array_unshift 这个函数的用法列举一下.
array_unshift
该函数的作用是在数组开头插入一个或多个元素,被加上的元素作为一个整体添加,这些添加的元素在数组中的顺序和在参数中的顺序一样,修改后的数组中所有的数值键名将修改为从零开始重新计数,所有的文字键名保持不变,该函数会返回操作后数组中元素的个数.
语法:int array_unshift(array &$array ,mixed $var [,mixed $… ])
PHP实例代码如下:
- <!–?php
- $queue = array("phpfensi.com",".com");
- array_unshift($queue,"apple","raspberry");
- print_r($queue);
- /*以上例程会输出:
- Array
- (
- [0] => apple
- [1] => raspberry
- [2] => phpfensi.com
- [3] => .com
- )*/
当然我们还可以直接使用其它的办法了,如创建一个数组重新给他赋值即可.
波比源码 – 精品源码模版分享 | www.bobi11.com
1. 本站所有资源来源于用户上传和网络,如有侵权请邮件联系站长!
2. 分享目的仅供大家学习和交流,您必须在下载后24小时内删除!
3. 不得使用于非法商业用途,不得违反国家法律。否则后果自负!
4. 本站提供的源码、模板、插件等等其他资源,都不包含技术服务请大家谅解!
5. 如有链接无法下载、失效或广告,请联系管理员处理!
6. 本站资源售价只是赞助,收取费用仅维持本站的日常运营所需!
7. 本站源码并不保证全部能正常使用,仅供有技术基础的人学习研究,请谨慎下载
8. 如遇到加密压缩包,请使用WINRAR解压,如遇到无法解压的请联系管理员!
波比源码 » php数组元素添加到数组头部(array_unshift的用法)
波比源码 » php数组元素添加到数组头部(array_unshift的用法)
levofloxacin 250mg for sale levofloxacin 500mg pill
brand dutasteride celecoxib brand cheap ondansetron 8mg
spironolactone 25mg price fluconazole us order diflucan online
buy acillin for sale order ampicillin 250mg pills erythromycin 500mg pill
purchase sildenafil online cheap robaxin oral methocarbamol 500mg pill
sildenafil tablet sildenafil over counter buy estradiol 1mg pill
lamotrigine 50mg sale oral lamictal 200mg order generic retin
buy tadalis online cheap purchase avana sale buy voltaren generic
purchase indomethacin pill order trimox pills order amoxicillin sale
buy tadalafil 40mg ed shots sildenafil 50mg over the counter
order arimidex 1mg online Discount viagra no rx real viagra pills
tadalafil 20mg generique acheter 100mg sildenafil generique viagra 200mg
cialis 10mg kaufen ohne rezept cialis 10mg generika sildenafil 50mg generika rezeptfrei kaufen
order accutane for sale cost stromectol 12mg ivermectin 3mg tablet
order provigil 100mg pill Buy cialis discount diamox 250mg canada
buy altace 5mg pills azelastine 10ml canada astelin 10 ml tablet
catapres pill minocycline 100mg pills oral tiotropium bromide 9 mcg
buy prograf 1mg generic labetalol cheap urso tablet
isosorbide 40mg brand isosorbide 20mg drug telmisartan 20mg uk
zyban 150 mg oral order bupropion 150mg sale buy quetiapine 50mg pills
zoloft for sale buy lexapro pill sildenafil 50mg
tadalafil 40mg pills buy symmetrel 100mg pill order symmetrel 100 mg without prescription
buy avlosulfon 100mg without prescription nifedipine cheap perindopril 8mg tablet
order medroxyprogesterone 10mg online cyproheptadine pills periactin 4mg pill
order provigil 200mg generic buy generic stromectol buy ivermectin 12 mg online
buy fluvoxamine 50mg generic ketoconazole generic order generic glipizide
nootropil 800 mg pills usa pharmacy viagra generic viagra 100mg
oral lasix 40mg buy furosemide pill order hydroxychloroquine 400mg online
buy sporanox 100mg pill order prometrium pills buy tindamax 300mg online
order glucophage 500mg for sale brand atorvastatin purchase cialis pill
order clozapine 50mg sale decadron cheap dexamethasone 0,0,5 mg for sale
zyvox 600mg generic order zyvox generic online casino no deposit bonus
omeprazole 20mg for sale purchase prilosec pill cash poker online
buy lopressor 50mg sale order atenolol 100mg online levitra 10mg uk
academicwriting blackjack card game rivers casino
write me a essay academic writing terms sildenafil 50mg
buy clomid 50mg without prescription order ventolin inhalator generic real money casino online
cialis online order buy tadalafil 5mg online cheap sildenafil citrate 50 mg
aristocort over the counter desloratadine tablet order clarinex generic
order tadalafil 5mg online cheap cialis coupons buy clopidogrel without prescription
order motilium 10mg pills oral cyclobenzaprine cheap cyclobenzaprine
losartan 50mg cheap cozaar 25mg over the counter topamax usa
buy baclofen without prescription buy tizanidine without prescription buy toradol online
imitrex 25mg generic buy dutasteride generic order avodart 0.5mg without prescription
order colchicine 0.5mg online cheap roulette online free luckyland slots
cost cialis 40mg order generic cialis 40mg buy ciprofloxacin 500mg
buy simvastatin 10mg generic order simvastatin for sale proscar online
poker online game casino slot games buy cialis 5mg generic
buy sildenafil 50mg order cialis sale tadalafil 5mg cost
order retin cream buy retin without prescription buy generic avanafil 100mg
generic tadacip order tadacip without prescription buy indomethacin 75mg generic
tiotropium bromide online minocycline 50mg ca hytrin canada
singulair 5mg cost viagra online buy cheap sildenafil pill
pioglitazone 30mg us order viagra 50mg pill purchase sildenafil online cheap
viagra cialis Buy cialis once daily buy tadalafil 40mg generic
stromectol online symmetrel 100mg us dapsone sale
order nifedipine 30mg generic allegra 120mg oral allegra 120mg brand
free casino real money online casinos usa play roulette
ramipril 10mg us etoricoxib 120mg generic cost arcoxia 120mg
term paper service buy arava 10mg sale buy azulfidine 500mg generic
order benicar 20mg online olmesartan 10mg ca generic depakote 250mg
temovate us buspirone 5mg sale order amiodarone 200mg online cheap
Thank you for great article. Hello Administ . 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…
Thank you for great article. Hello Administ . 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…
order tricor generic purchase tricor generic buy viagra 100mg for sale
Hello! I could have sworn I’ve been to this blog before but after browsing through some of the post I realized it’s new to me. Onwin , Onwin Giriş , Onwin Güncel Giriş , Onwin Yeni Adres , onwin
serophene usa order atorvastatin 40mg online cheap buy prednisolone 40mg generic
buy sildenafil 50mg sale buy ed medications online order proscar 1mg for sale