引号中,任何变量($var)、特殊转义字符(如“t r n”等)不会被解析,因此php的解析速度更快,转义字符仅仅支持“’”和“”这样对单引号和反斜杠本身的转义;
在字串中使用变量
这个功能让你无须使用连接符号来粘和大量的简单字符串,php允许我们在双引号串中直接包含字符串变量,我们可以发现下面的两个字串的处理结果是相同的。
$full_name = $first_name . ' ' . $last_name;
$full_name = "$first_name $last_name";
单引号串和双引号串在php中的处理是不相同的。双引号串中的内容可以被解释而且替换,而单引号串中的内容总被认为是普通字符。例如:在字符串中引用复杂的变量组合时,可能会产生一些问题,下面的代码会正常工作:
echo "value = $foo";echo "value = $a[$i]";
而下面的代码却不能得到我们希望的结果:
echo "value = $a[$i][$j]"; //我们希望打印二维数组$a的某个元素。
为避免这些字串使用中的潜在问题,我们通常把复杂的变量从字串中分离开来,就像这样:
echo 'value = ' . $a[$i][$j];
还有一种办法是将复杂变量用花括号括起来,语法分析器就能正确辨认了:
echo "value = {$a[$i][$j]}" //打印二维数组$a的某个元素
这样,又出现新问题了。当我们想在字串中引用花括号字符本身时,就要记得使用转义符了:
- $var = 3;
- echo "value = {$var}"; // 打印结果 "value = 3"
- echo "value = {$var}"; // 打印结果 "value = {3}"
- $foo = 2;
- echo "foo is $foo"; // 打印结果: foo is 2
- echo 'foo is $foo'; // 打印结果: foo is $foo
- echo "foo is $foon"; // 打印结果: foo is 2 (同时换行)
- echo 'foo is $foon'; // 打印结果: foo is $foon
双引号中,变量($var)值会代入字符串中,特殊转义字符也会被解析成特定的单个字符,还有一些专门针对上述两项特性的特殊功能性转义,例如“$”和“{$array[‘key’]}。这样虽然程序编写更加方便,但同时php的解析也很慢;
引号内部的变量不会执行,双引号会执行,如:
- $name = 'hello';
- echo "the $name";
会输出 the hello,而如果是单引号:
- $name = 'hello';
- echo 'the $name';
会输出 the $name,主要区别就是这个,其他的无所谓,看你自己喜欢了,推荐是保持一致,如用单引号其他地方保持一致就可以了.
波比源码 » php中单引号与双引号的区别
purchase levaquin purchase levaquin pills
dutasteride pills purchase tamsulosin generic buy zofran 8mg without prescription
spironolactone 100mg pill diflucan 100mg over the counter diflucan over the counter
cheap ampicillin buy cephalexin for sale buy erythromycin 250mg for sale
order fildena 100mg online cheap buy careprost buy generic methocarbamol
sildenafil for sale online buy estrace 2mg generic purchase estradiol online cheap
oral lamotrigine 50mg purchase lamotrigine without prescription tretinoin cream us
order tadalis 10mg online tadalafil 10mg oral diclofenac 100mg cheap
order indocin 75mg pill buy terbinafine 250mg without prescription amoxicillin 500mg without prescription
anastrozole 1mg canada buy biaxin without prescription oral sildenafil 50mg
tadalafil 5mg generika tadalafil generika rezeptfrei kaufen sildenafil 100mg kaufen für männer
accutane 40mg sale zithromax 250mg generic buy ivermectin for humans australia
modafinil 200mg us order diamox 250mg for sale acetazolamide 250mg for sale
buy altace for sale astelin 10 ml over the counter azelastine oral
order alendronate 35mg without prescription famotidine 40mg oral buy famotidine without prescription
prograf over the counter labetalol 100mg drug ursodiol for sale online
order imdur 40mg generic lanoxin 250 mg without prescription telmisartan order online
generic bupropion order zyban 150mg generic quetiapine 50mg us
order tadalafil for sale buy tadalafil pills order amantadine 100 mg pills
buy naltrexone 50mg online generic letrozole aripiprazole 30mg usa
order generic provera microzide canada cyproheptadine over the counter
purchase luvox buy generic fluvoxamine 50mg buy glucotrol 10mg generic
buy accutane 10mg for sale brand amoxil 250mg prednisone 40mg generic
order azithromycin online cheap neurontin 800mg cost order neurontin generic
order cialis 10mg online cialis without a doctor prescription order anafranil online
sporanox 100 mg oral buy prometrium 100mg sale order tinidazole 300mg for sale
glycomet over the counter order glycomet 1000mg cheap tadalafil sale
viagra 100mg brand viagra tablet buy lisinopril online cheap
prilosec 10mg oral buy omeprazole online cheap ocean casino online
zyvox 600mg cheap zyvox 600mg ca roulette online real money
buy generic lopressor 100mg buy lopressor online cheap brand levitra 20mg
college essay for sale play roulette free for fun best online gambling
dapoxetine 60mg oral order generic priligy 60mg order synthroid online
orlistat pills acyclovir 800mg usa zovirax 800mg without prescription
buy tadalafil 40mg without prescription clopidogrel buy online clopidogrel oral
purchase allopurinol pill ezetimibe for sale online zetia price
methotrexate 10mg uk order methotrexate 2.5mg for sale reglan 20mg brand
ozobax without prescription toradol 10mg usa buy toradol
casino online slot machine gambling casino online
purchase cialis online cheap cost tadalafil ciprofloxacin 500mg brand
keflex 500mg cost cheap erythromycin erythromycin without prescription
overnight delivery for viagra order cialis 10mg for sale cheap cialis online
ceftin 500mg sale order ceftin sale robaxin pills
trazodone order online purchase aurogra aurogra 50mg ca
viagra sildenafil 50mg viagra order online tadalafil 10mg price
online poker free male erection pills cheap cialis generic
zithromax 250mg ca cheap prednisolone tablets purchase gabapentin generic
lasix drug order lasix pill order hydroxychloroquine 200mg without prescription
purchase sildenafil online tamoxifen cost budesonide uk
cheap prednisone 5mg prazosin online buy mebendazole 100mg cost
order tretinoin online cheap order retin without prescription buy avanafil
order tadacip 10mg without prescription generic indocin 75mg order indomethacin generic
purchase lamisil lamisil 250mg us purchase trimox generic
purchase altace online cheap purchase amaryl sale order arcoxia 60mg for sale
free poker games online poker free write papers online
writing paper online academic writing uk buy generic azulfidine
olmesartan us purchase calan online depakote pills
purchase diamox without prescription order imdur pill azathioprine 25mg tablet
amoxil 500mg uk buy stromectol 12mg without prescription how much is ivermectin
dapoxetine 60mg generic domperidone 10mg uk purchase domperidone online cheap
pamelor over the counter buy generic pamelor 25mg paroxetine 20mg tablet
doxycycline 200mg ca chloroquine us methylprednisolone 16mg tablets
buy requip 1mg for sale order calcitriol sale labetalol 100 mg price
tadacip pills plavix 75mg ca trimox 500mg canada
buy cialis 10mg sildenafil 100mg tablets cheap viagra tablets
order minocin 100mg pills minocycline 50mg usa generic hytrin 1mg
buy metformin online nolvadex order nolvadex over the counter
order modafinil sale provigil buy online promethazine pills
clomiphene for sale order clomid 50mg without prescription prednisolone 20mg pill
accutane 10mg generic prednisone order order ampicillin 250mg online
generic ivermectin buy prednisone 5mg pill buy prednisone 10mg generic
order isotretinoin 40mg without prescription order amoxicillin sale oral zithromax 250mg
order doxycycline 200mg generic zovirax 400mg drug oral zovirax
purchase oxybutynin buy trileptal for sale oxcarbazepine order
simvastatin 20mg generic order generic promethazine sildalis tablet
dapsone over the counter avlosulfon 100mg uk tenormin 50mg sale
order generic alfuzosin 10mg purchase desyrel online cheap order diltiazem without prescription
zetia pills zetia online order generic methotrexate
buy warfarin 5mg sale purchase metoclopramide order allopurinol 100mg for sale
cialis for sale https://hippharmo.com/
trazodone vs duloxetine cymbalta doses cymbalta side effects sweating
zoloft tremors zoloft and fatigue how to taper off sertraline
latuda and seroquel https://seroquelquetiapinedik.com/ trade name of quetiapine
how do i get off prilosec https://prilosecomeprazoleuxe.com/ omeprazole reviews
when to take amlodipine morning or night amlodipine and anxiety norvasc and amlodipine
how to stop taking escitalopram 10 mg https://lexaproescitalopramtns.com/ lexapro and melatonin
is duloxetine the same as cymbalta cymbalta side effects in men cymbalta and bipolar
weight gain with zoloft https://zoloftsertralineaco.com/ how does sertraline work for anxiety
quetiapine fumarate alzheimer’s https://seroquelquetiapinevuq.com/ quetiapine side effects elderly
how does omeprazole work in the body https://prilosecomeprazolezrv.com/ where to buy omeprazole
norvasc congestive heart failure norvasc 10 mg norvasc drug recall
can i drink while taking escitalopram https://lexaproescitalopramogv.com/ escitalopram (lexapro)
can i take advil with duloxetine what’s the side effects of duloxetine? lyrica versus cymbalta
does zoloft cause weight loss long term effects of zoloft how to wean off of zoloft
seroquel cause weight gain what does seroquel do quetiapine xr
what is omeprazole taken for https://prilosecomeprazolerls.com/ how much does prilosec cost
prozac and alcohol https://prozacfluoxetinerfk.com/ scorpio men on prozac
lexapro and sex https://lexaproescitalopramikd.com/ is escitalopram a benzo drug
cymbalta withdrawal symptoms list cymbalta side effects urination cymbalta side effects
seroquel and hydrocodone https://seroquelquetiapinesxz.com/ seroquel and cocaine
prilosec amazon https://prilosecomeprazolerls.com/ can prilosec cause yeast infection
prozac and appetite prozac side effects anxiety can fluoxetine get you high
can you od on escitalopram cbd oil and lexapro escitalopram 20 mg
can you take wellbutrin and fluoxetine together fluvoxamine vs fluoxetine venlafaxine vs fluoxetine