百度一下关于php获取变量名的办法都是下面这个函数。但是用了发现有点bug
/**
* 获取变量名
*
* @param $string
* @return $string
*
* $test = "helo";
* $test2 = "helo";
* getVarName($test2);
*/
function getVarName(&$src){
//存储当前变量值
$save = $src;
//存储所有变量值
$allvar = $GLOBALS;
//在函数中不要直拉遍历$GLOBALS,会出现堆栈问题
foreach($allvar as $k=>$v){
//变量值相同,可能不是相同变量,因多个变量的值可能相同
if ($src == $v){
//改变当前变量$src的值
$src = ‘change’;
//如果$GLOBALS[$k]也跟着改变,那就是同一个变量。
if ($src == $GLOBALS[$k]){
//echo "$$k name is $k
";
//还原变量值
$src = $save;
return $k;
}
}
}
}
copy下来后发现这个怎么测试结果有时候对有时候不对,想了很久,终于弄明白,虽然很简单,但是自己还是记录下,希望遇到同样情况的同学注意。
比如:现在我测试
$test2 = "hello";
$countNum=0;
echo getVarName($test2);
//按道理应该输出为”test2“,但是输出的是"countNum",
因为函数中的
if ($src == $v) 这里存在问题 比如$src="hello", $GLOBALS里面有个变量$countNUm=0;
这时在循环的时候判断 if ($src == $v) ,即"hello"==0,比较的结果为true,类型转换的时候“hello“转为整形为0,
然后就退出循环了,得到错误的结果。
一个解决办法就是 if ($src == $v) 改为 if($src===$v),即恒等。
如果我理解错了欢迎您指正,一起进步。
波比源码 » PHP获取变量的变量名的一段代码的bug
levofloxacin ca brand levaquin
avodart 0.5mg usa buy flomax 0.4mg pills ondansetron 4mg pill
aldactone 25mg pill propecia 5mg brand diflucan 200mg for sale
ampicillin 500mg us cephalexin online purchase erythromycin online
sildenafil 100mg without prescription order generic bimatoprost methocarbamol over the counter
suhagra for sale suhagra 50mg us estradiol 1mg brand
oral tadalafil buy tadacip 20mg for sale order voltaren 50mg online
isotretinoin 20mg for sale amoxicillin 1000mg for sale zithromax 250mg cost
anastrozole 1 mg generic Fda approved viagra sildenafil next day
deltasone pill purchase deltasone online sildenafil 50mg sale
tadalafil 5mg kaufen ohne rezept viagra 100mg kaufen viagra 50mg kaufen
purchase provigil acetazolamide 250mg pill buy acetazolamide 250 mg without prescription
buy doxycycline online cheap order lasix sale lasix buy online
altace 5mg ca generic avapro 300mg buy azelastine for sale
order catapres 0.1mg online cheap minocycline cheap spiriva 9mcg pill
buspar 10mg ca brand buspirone 5mg buy oxybutynin 5mg online
order terazosin generic order arava 20mg sale generic azulfidine
fosamax pill ibuprofen order buy famotidine 40mg generic
generic prograf 1mg prograf medication cost urso 150mg
generic zoloft 50mg Buy viagra professional real viagra pills
tadalafil 10mg drug order tadalafil generic amantadine 100mg cost
provera pills order hydrochlorothiazide 25mg online cyproheptadine 4mg cheap
buy modafinil 200mg sale order modafinil 100mg online ivermectin lotion 0.5
isotretinoin 10mg uk deltasone online order order deltasone 10mg online cheap
order nootropil 800mg sale sildenafil for sale sildenafil pills
azithromycin sale order gabapentin 100mg online gabapentin online buy
tadalafil tablets buy tadalafil 10mg pills order viagra 50mg online cheap
cost furosemide 100mg lasix for sale hydroxychloroquine 400mg for sale
metformin 500mg usa generic atorvastatin order cialis 20mg online
norvasc 5mg drug cialis 10mg tablet order generic cialis 20mg
order zyvox 600mg online online black jack bonus casino
metoprolol uk buy vardenafil 10mg levitra generic
term papers for sale play money poker online slots games
order levitra 20mg pills order vardenafil 10mg generic medrol us
dissertation writers online rx pharmacy online viagra sildenafil in usa
order clomid 50mg pills clomid 50mg sale online casino bonus
priligy 90mg for sale priligy 90mg without prescription order levothyroxine online cheap
cheap orlistat 120mg buy diltiazem pills zovirax 800mg cheap
buy cialis order generic clopidogrel 150mg plavix price
order allopurinol 100mg online ezetimibe 10mg without prescription zetia for sale online
motilium generic motilium 10mg for sale buy flexeril 15mg for sale
baclofen price buy tizanidine without prescription brand ketorolac
colchicine without prescription slot machine games chumba casino
order zantac 300mg pills order meloxicam 15mg pill celebrex oral
poker online play play poker online free no sign up blackjack online betting
buy flomax 0.4mg online cheap flomax tablet aldactone 100mg sale
order zocor 10mg order valacyclovir 500mg online cheap order proscar online
order keflex 250mg generic clindamycin brand order erythromycin 500mg
cialis mail order us cheap tadalafil 10mg sildenafil overnight
order desyrel 50mg pills order aurogra generic buy aurogra 100mg without prescription
where can i buy a research paper generic stromectol ivermectin generic name
sildenafil over counter estrace 1mg over the counter order lamotrigine 200mg
prednisone tablet deltasone 10mg pill cheap amoxicillin pill
viagra ca buy viagra online cheap order tadalafil online cheap
order zithromax 250mg online cheap buy gabapentin 800mg order generic neurontin 800mg
can you play poker online money buy tadalafil 10mg online generic tadalafil 5mg
slot machine casino slot games buy generic modafinil
order furosemide generic order doxycycline pill order hydroxychloroquine 200mg online cheap
purchase sildenafil sale budesonide cheap budesonide over the counter
buy tretinoin gel online cheap tadalis over the counter buy avana 100mg without prescription
tadalafil brand brand voltaren 100mg order indocin 50mg online
order lamisil sale buy lamisil online buy amoxicillin 500mg
biaxin 500mg sale order catapres 0.1mg for sale order antivert generic
proventil sale buy pantoprazole pills cipro 500mg generic
spiriva online order buy minocycline pills hytrin 5mg over the counter
montelukast without prescription buy singulair pill viagra 25mg for sale
cost cialis Buy cialis online without prescription online roulette for real money
ivermectin otc order symmetrel 100mg generic dapsone 100 mg generic
play casino online free roulette online gambling money sports gambling
nifedipine 10mg sale nifedipine price allegra 120mg us
roulette free top canadian online pharmacy cheap paper writing
websites for essay writing help with assignments uk sulfasalazine cost
asacol 800mg oral order astelin irbesartan oral
temovate over the counter clobetasol online order amiodarone 200mg ca
buy doxycycline 100mg online cheap oral medrol cost buy medrol 16 mg online
order fenofibrate 160mg online cheap buy sildenafil 50mg without prescription genuine viagra
buy metformin 500mg generic buy calan pills nolvadex pills
deltasone 10mg pills amoxil 250mg drug amoxil 1000mg pills
order fildena 100mg online order finasteride 5mg cost proscar 5mg
cost accutane buy generic accutane 40mg acillin price
prednisolone without prescription buy prednisolone 40mg online cheap cost furosemide 40mg
buy zocor 20mg without prescription order generic simvastatin sildalis order
buy sildenafil 50mg online cheap real viagra pharmacy prescription order tadalafil online
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.
order cetirizine online cheap order zyrtec 10mg for sale sertraline price
buy generic cenforce 100mg buy aralen for sale glycomet 1000mg for sale
lexapro where to buy buy cheap generic prozac where can i buy naltrexone
buy lipitor 20mg for sale canadian viagra and healthcare sildenafil online
tadalafil for sale fda approved over the counter ed pills top ed drugs
order provigil generic order provigil 100mg prednisone 20mg usa
buy amoxicillin tablets how to buy azithromycin prednisolone 20mg without prescription
purchase tenormin generic letrozole buy online buy generic femara online
buy generic lyrica loratadine canada buy priligy 90mg generic
order methotrexate 5mg without prescription methotrexate cost reglan online buy
orlistat medication buy cheap generic zovirax buy zyloprim sale
order crestor 10mg pill buy generic domperidone for sale domperidone 10mg for sale
sumatriptan 25mg usa order imitrex generic buy generic avodart for sale
oral toradol buy generic colchicine 0.5mg buy generic propranolol
buy zantac medication oral ranitidine 150mg brand celecoxib
plavix 75mg pills buy ketoconazole sale buy ketoconazole cheap
buy generic tamsulosin aldactone pills aldactone 100mg canada
betnovate cheap buy clomipramine 25mg online cheap order sporanox 100mg pill
order simvastatin 20mg pills purchase valacyclovir generic sildenafil without prescription
buy carbamazepine 400mg pill ciplox 500 mg brand lincocin without prescription
tadalafil 40 mg order tadalafil for sale viagra sildenafil 100mg
diflucan 100mg cheap purchase fluconazole pill order ciprofloxacin 500mg online
how to buy estradiol order estradiol 1mg online buy prazosin for sale
order vermox 100mg sale buy mebendazole 100mg online buy tadalis 10mg generic
clindamycin sale cleocin for sale online the best ed pill
buy avanafil pills cost tadalafil 20mg buy diclofenac 50mg generic
buy minocin tablets minocycline 50mg generic order actos 15mg without prescription
how to buy isotretinoin amoxil 1000mg pill generic zithromax 250mg
buy arava for sale leflunomide 20mg for sale buy sulfasalazine 500mg pills
azithromycin for sale order omnacortil 40mg sale gabapentin 800mg canada
tadalafil 5mg cost order tadalafil online cheap order tadalafil 10mg for sale
ivermectin price canada order prednisone 40mg pill buy prednisone 40mg online cheap
buy lasix 40mg sale brand furosemide buy ventolin 4mg
buy vardenafil online buy vardenafil 10mg online cheap plaquenil 200mg without prescription
altace 5mg price glimepiride canada generic arcoxia 60mg
order levitra 20mg without prescription order levitra for sale purchase plaquenil generic
benicar 10mg cheap verapamil 120mg brand order depakote 500mg sale
order carvedilol 6.25mg generic buy cenforce 100mg generic buy chloroquine generic
cheap lanoxin buy micardis generic buy molnunat without prescription
buy naproxen 250mg for sale buy omnicef pill buy lansoprazole generic
order albuterol order generic pantoprazole 20mg pyridium pills
buy generic olumiant 2mg buy cheap olumiant buy atorvastatin without prescription
singulair canada montelukast 10mg pill order avlosulfon 100 mg generic
norvasc online omeprazole 10mg over the counter buy cheap generic prilosec
adalat 30mg drug nifedipine sale order allegra 120mg online cheap
dapoxetine 30mg us cytotec 200mcg usa buy orlistat online cheap
buy metoprolol without a prescription metoprolol us methylprednisolone oral
order diltiazem online buy diltiazem 180mg sale buy allopurinol 100mg online
crestor cost where to buy crestor without a prescription buy domperidone
acillin canada buy metronidazole 200mg for sale metronidazole online
order bactrim bactrim 960mg price order cleocin pills
purchase plavix online buy medex online cheap buy cheap warfarin
generic reglan cost nexium cost esomeprazole
budesonide us ceftin 500mg sale purchase careprost generic
topamax buy online order imitrex 50mg generic levaquin canada
purchase dutasteride without prescription ranitidine sale purchase meloxicam without prescription
buy generic celebrex tamsulosin cost zofran ca
purchase lamictal without prescription order mebendazole online cheap order prazosin generic
spironolactone usa simvastatin price valacyclovir 500mg without prescription
buy retin online cheap order tretinoin cream online cheap cheap avana 100mg
cialis pills 40mg order tadalafil 10mg without prescription viagra next day delivery usa
cialis 20mg brand cialis 40mg tablet best ed pill
lamisil brand buy suprax trimox 500mg canada
depakote canada order generic acetazolamide 250 mg buy imdur 40mg pill
brand meclizine 25mg order tiotropium bromide 9 mcg without prescription minocin 50mg oral
molnupiravir brand buy naprosyn 500mg for sale order cefdinir 300mg online cheap
generic ed pills sildenafil 100mg tablet sildenafil 100 mg
over the counter ed pills brand name cialis order cialis 5mg for sale
allegra 180mg cost order allegra for sale glimepiride pills
arcoxia canada astelin generic buy azelastine 10ml for sale
buy cordarone 200mg pill cheap amiodarone 200mg brand phenytoin 100 mg
albendazole buy online albenza order order provera sale
order ditropan 2.5mg generic buy amitriptyline generic brand fosamax 70mg
order praziquantel without prescription buy periactin 4mg without prescription purchase cyproheptadine pill
order generic nitrofurantoin 100mg furadantin 100 mg drug order nortriptyline 25 mg without prescription
order anacin 500 mg generic order paxil 20mg pill pepcid 40mg pill
order glucotrol 10mg piracetam oral buy betnovate creams
buy clomipramine for sale prometrium 100mg generic order progesterone sale
purchase tindamax pill olanzapine 10mg oral order nebivolol 5mg pills
dexamethasone 0,5 mg uk zyvox 600mg for sale nateglinide over the counter
buy cheap trileptal order trileptal 600mg for sale buy urso 150mg generic
capoten cost candesartan generic order tegretol 400mg pills
purchase quetiapine online cheap buy quetiapine 100mg online order lexapro 20mg without prescription
purchase combivir sale brand accupril 10 mg quinapril generic
prozac cheap revia ca letrozole medication
buy valaciclovir medication buy generic famciclovir order ofloxacin without prescription