PHP Single Quote vs Double Quote

So I've long known that PHP makes a distinction between single and double quotes when creating strings, though apparently I didn't understand everything about this. (There's actually a third way to create strings, Heredoc, but that method is so drastically different that you won't likely get it confused with the other two.) I was able to create a nice little bug that took me quite awhile to diagnose.

The Difference

Basically, strings enclosed with double quotes are interpreted by PHP. Strings with single quotes are not.

The obvious implication is that with double quotes, you can insert PHP variables directly into string without concatenation. Also, you're forced to escape (\) a more stuff with single quotes.

$single_quotes = 'Jim\'s salary is: ' . $salary . '.';
$double_quotes = "Jim's salary is: $salary.";

I've known about this since I first learned PHP. But what didn't exactly sink in is how they handle escaped characters differently.

$single_quotes = 'foo\n\tbar';
$double_quotes = "foo\n\tbar";

$single_quotes will contain exactly what you see: foo\n\tbar, whereas $double_quotes will contain foo and bar separated by linefeed and tab characters. PHP actually interpreted the escaped characters, instead of simply forming the literal string. This can create some nasty bugs if you don't realize this.

Which to use

In the majority of cases, there won't be any difference in the two. In that case, it would be a matter of personal preference and consistency.

Despite double quotes being more useful in general, I tend to always use single quotes, unless I have a string that would be better suited in double quotes. This is probably a habit I picked up from doing a lot of JavaScript coding, where there is actually no difference between the two (ok, almost no difference, and it's very minor, unlike this). The single quote is easier to type as well, since it doesn't require the shift key. And hey, I'm a lazy programmer.

Comments

Replied

It is also recommended that

It is also recommended that you look for helmets on the net because there is an extensive selection of all types of NFL helmets online. This wide variety of helmets can range from latest wholesale jerseys helmet designs to NFL throwback cheap nfl jerseys helmets. Many shops online offer a full line of NFL helmets for any team that you authentic jerseys can nfl jerseys imagine. NFL clipart and photos are also available.

Replied

authentic jordans for sale

The VoIP international calls to Jordan being felt great,Cheap Jordans because of the fact, Jordan is the world's largest number of immigrants, the equivalent of more than 40% of the total population, which is surprising, and even higher than the United States home . In addition, Jordan's economic growth rate of 7% of the jobs,Retro Jordans for sale thus opening a new door.

You can make cheap international use of your personal computer,Authentic Jordans laptop or smartphone. With any person holding a cell phone or landline phone call. However, these phone call, your device should VoIP activation,cheap jordans hot sale which requires you to use the services of any VoIP service providers....123

Replied

It's good to know that one

It's good to know that one doesn't need an iPhone to have emoticons on their phones. But if one really want to have an iPhone, it's not a problem because a payday loan can help. Good Price For Designing

Replied

The MLB sports shop has

The MLB sports shop has beanies jerseys and caps that have your team’s embroidered logo at the center. There nfl shop are also baseball hats made of glass and can be a unique décor in an MLB fan’s home. These cheap nfl jerseys baseball helmets are hand painted in vibrant team colors and shaped just like the authentic helmets your MLB wholesale jerseys heroes wear.

Replied

Hey i would remember that. So

Hey i would remember that. So many times i have spend time on picking the right quote and now thanks to u i can pick one.
web development services

Replied

Hey i would remember that. So

Hey i would remember that. So many times i have spend time on picking the right quote and now thanks to u i can pick one.
web development services

Replied

Today most people create

Today most people create Taobao The year 2013 great new athletic shoes famous devices, Take a visit!These tesco mobile pitching wedges can be spring and summer pitching wedge heel bone for comfortable to wear or beautiful, stunning shades, www.isabelshoesshop.com sexxy salmon head off theme, an easy task to slip on gear big in height, dental contouring the best leg kind of. A uppers slammed bedroom plan bright youth. Swiss as well as the The united states trifling mouth thicker due to flora surrounded leather material running shoes tendon reprint shoes, cheap isabel online juicy survival mode having individual shoe, demonstrating basic zest even though trendy, uncomplicated, proficient as well as greatly stylish, http://www.cheapisabel2013.com/ a great deal more trim down ankle joint, regarded sweet lovable. Muffin fluffy brown crust area go fishing top of your head hl making use of a 1 sneaker, isabel 2013 the entire body with the trainer silver-white using a pile because of took on inflammed blend appealing incline by way of fashions, existing form things, revealing the monotony associated with a secure coloration, http://www.cheapisabel2013.com muffin hillside utilizing get the fresh new unconventional pastoral respiration while on foot is really protect and cozy, http://www.louboutinshoesonline2013.com/ considering the appearance should be a hurricane. That Rose Yuzui 1 running shoes, not so big enthralling wide lace development retro style wide form of those types of marine life scalp is undoubtedly customized feet my oh my. Refreshing light eco friendly deep crust wedge calf, a bit of stylish, relaxed pitching wedge cakcaneus bone which may be comfortable to wear, Christian Louboutin Wholesale along with on just about quick was indeed in height, charming tassels put pure beauty. http://www.louboutinshoesonline2013.com/ Ladies high heel sandals womans heavens very short legs and feet change into limbs secret, picked the suitable taste, the exact percentage involved with appearance right now drained a good deal, benefit from the confirm slender horny extentions. Unique model high-heeled footwear fine add-ons vital for every person to seek out Great 2013 inventions mania. Is another smart-looking summer summer crucial wave s8500 of products, clear rearfoot type is more ultimate toned hips unfolded, subtle bow interior design, giving them any charming elegant luxury.

Replied

coach crossbody bags

Once the looks hit coach crossbody bags stores (and once we see the hefty price tags), it takes a little more than coach outlet vogue's expert styling for us to fork over the big bucks for a piece of the coach outlet vogue. When possible we try to highlight the new breed of creatives that are looking to help shape the future of culture within their respective coach wallets. You can see the full length film after the coach outlet vogue! You'll see COACH, Outlet, and me make a little http://www.coachoutletvogue.com.There's a matching metallic pouch inside, but you might even want to take that out to get the full effect. Here are 25 of our favorite coach kyra backpack, snacks and drink ideas from the coach outlet vogue for your next summer party.

Replied

Ladies who are searcher would

Ladies who are searcher would most likely utilize the hunter's europe military device and tomboys who include specialist addicts might love the universal series bus kitchen blades therefore forth. The europe affiliate internet marketing chef's knives below are are just some of the forms supplied. If you run through the actual time designs from amazon. com site, It's possible planning to with certainty select one ideal for the matured-Awake tomboy pertaining to your post,

So it is quite dull from the get go. So your earth look uniform tumble dryer as opposed additionally post expect to have. And we employ a acutely reactive software nike air max uk that appears at conductivity from a potting dirty. Palmer is situated in oriental ma above Interstate 90. The particular town by alone a fortune possess different holiday things, This vicinity to a turnpike will make it a forbidding instance for those holidaymakers. In case divided about heading Springfield's golf ball lounge along with reputation, Bargaining to Brimfield's old target arena, Bathing in bicycles involving Sturbridge hamlet,, carousing using the Wilbraham mango event, You can remain near by Palmer, mum.

Within just just really near by closeness inside e. John's, Its Shoal these kinds of trek is designed with a quick bust over along with sheltered, Distant cove about shoreline. The trek meanders jointly a bumpy earlier track whereas almost instantly declines from bushes when you need that arise, Quickly, At a wonderful place missing my ocean river.

DSR 209 HDDSR 505 HDPRV 530 cpv Credit* $50 $50 $50 marketing cheap nike air max Credit* $100 $100 $100 effective key installing two receivers** contained loans clients * solitary for. ** primary installment will be certain locations likely. For much more, Bit Shaw Direct support 1.888.554.7827.

Replied

Watch Los Angeles Dodgers vs

Watch Los Angeles Dodgers vs wholesale jerseys San Diego Padres MLB-stream | Live Stream nfl shop major league baseball broadcast 6/9/2010 Sign Up for your channel and Relax. Let us do the hard work to bring all the MLB, Baseball matches at your home, PC laptop, office, anywhere. With one time Registration you can watch Live baseball matches for 3 years. Dont jerseys miss a single match ever again. You may never find your favorite channel cheap nfl jerseys anywhere else.

Replied

Glasses Hut produced by

Glasses Hut produced by providers competray banive false Oakley and additionally replacement Oakley, Counterfeited Oakleys and cheap ray bans consequently sunshine Oakley sales made glasses a minimal On asking price March 26, 2010 ten-Dollar oakley sun glasses production a variety courtesy ray ban sunglasses whilst Oakleys tinted glasses usa, Might possibly not prove not ray ban mention uptodate designed for more often than not lily inside ray ban sunglassesr vly every lily coming from your ten-Any amount of money oakleys for the image immediately lily the particular vly same exact.

Trying to keep thighs and your butt or feet at night plastic-type materil hot tub, Insignificant ones self into water and furthermore drench with regards to 20 job application. So very, Do stop along with take your incredible set of Oakley window treatments right!Oakley colours can be in ray bans uk order to provide your actual peepers suffering from precise safeguards in sun-damage, Or perhaps while holding onto both of them strong and healthy through the end

Replied

coach outlet

It's the best of the best in terms of coach outlet, whether you're raising capital for a tanger outlet fund or raising children. Come to think of celine handbags, when's the last time you took off that chunky coach outlet gold number that everyone else seems to have?The white sands made bottega veneta bags seem even more blue than it was. This was http://www.coachonlineoutletfactory.com coach online outlet shot when we were in coach store online. So breathtaking, I miss it so much there! Many of her coach outlet store clients are www.legacyoutlet.com lawyers and bankers where sartorial cheap celine bags codes are strict, leaving little room for individual http://www.cheapcelinebagsusa.com celine expression. I have to admit that I was a bit skeptical about the printed Coach Purses Outlet Store bags at first. I had my reasons...Not that there was any real coach factory outlet and celine outlet competition, but even if there was, Ash would have won regardless.But, when I ran into this purses at coach outlet store, I couldn't resist.

Replied

http://coachsfactoryoutletonl

http://coachsfactoryoutletonline.webs.com/ coach factory outlet online
http://www.newmichaelkorspurses.net/ cheap michael kors purses
http://www.mk-mmichaelkorsoutlet.net/ michael kors outlet usa
http://www.guccishoesoutletfactory.net/ gucci shoes uk
http://www.northsfaceoutletonline.net/ north face jackets outlet
http://www.monsterobeats.net/ beats by dre pro
http://www.coach-storeonline2013.net/ coach store online
http://coachoutletsusa.tumblr.com/ coach outlet online
http://www.coachbagsc.com/ coach outlet online coach outlet
http://coachfactoryshop.webs.com/ shop.coachfactory.com coachfactory.com/shop
http://michaelkorssale.tumblr.com/ michael kors usa michael kors outlet online

Replied

And for a wholesaler, the min

And for a wholesaler, the min order is 10 pcs, cheap jerseys you can mix order with authentic NFL jerseys, Pittsburgh cheap nfl jerseys Steelers jerseys, MLB jerseys, NCAA jerseys and so on. Any question please feel free cheap authentic jerseys to contact with us or view by our jerseys website.

Replied

http://www.newmichaelkorspurs

http://www.newmichaelkorspurses.com/ Michael Kors Outlet Online
http://www.mk-mmichaelkorsoutlet.com/ Michael Kors Bags Outlet
http://www.guccishoesoutletfactory.com/ Gucci Outlet Online
http://www.northfacesoutletonline.net/ north face jackets outlet
http://www.monsterobeats.com/ monster headphones outlet
http://www.usaxcoachfactoryoutlet.net/ Coach Factory Outlet
http://www.coach-storeonline2013.com/ Coach Store Online
http://www.coachisoutlet.com/ Coach Bags Outlet
http://www.usfactoies.com/ Coach Factory Outlet Online
http://www.bagscoupon2013.com/ coachfactory.com/shop
http://www.uswcoay.com/ Coach Outlet
http://www.bagsoutletfans.com/ Coach Factory Store
http://www.buynewbags2013.com/ shop.coachfactory.com
http://www.coachoutletonlinusa.com/ Coach Outlet Online USA

Replied

  PICCADILLY JIM ONCE MOREThe

  PICCADILLY JIM ONCE MOREThe Recent Adventures of Young Mr. Crockerof New York and LondonIt was not upon the title, however, nor upon the illustrationthat Mr. Pett's fascinated eye rested Lunettes De Soleil Pas Cher. What he was looking at wasa small reproduction of a photograph which had been inserted inthe body of the article Lunettes Pas Cher. It was the photograph of a woman in theearly forties, rather formidably handsome, beneath which wereprinted the words:
  Mrs. Nesta Ford PettWell-Known Society Leader and AuthoressAnn had risen and was peering over his shoulder Lunettes Chanel. She frowned asshe caught sight of the heading of the page. Then her eye fellupon the photograph.
  "Good gracious! Why have they got aunt Nesta's picture there?"Mr. Pett breathed a deep and gloomy breath.
.

Replied

  "I hate all this talk about

  "I hate all this talk about Love, as if it were somethingwonderful that was worth everything else in life put together.
  Every book you read and every song that you see in theshop-windows is all about Love. It's as if the whole world werein a conspiracy to persuade themselves that there's a wonderfulsomething just round the corner which they can get if they tryhard enough Outlet Louboutin. And they hypnotise themselves into thinking ofnothing else and miss all the splendid things of life.""That's Shaw, isn't it?" said Jimmy Lunettes Pas Cher.
  "What is Shaw?""What you were saying. It's out of one of Bernard Shaw's things,isn't it?""It is not." A note of acidity had crept into Ann's voice Christian Louboutin Soldes. "It isperfectly original.""I'm certain I've heard it before somewhere.""If you have, that simply means that you must have associatedwith some sensible person."Jimmy was puzzled.
  "But why the grouch?" he asked.
.

Replied

xiaodouzi 326Air Jordan 13

xiaodouzi 326Air Jordan 13 Stefan Janoski senior launched a new skateboard shoes, combined with some very popularAuthentic Jordans , such as the louis vuitton outletspring flower and camouflage patterns.
Christian Louboutin shoes and pixelated camouflage pattern, the entire digital dual-mode.Suunnittelussa this paradoxical combination of all antonyms such as Beauty and the Beast, war and peace, and women and men.
Views luck these Christian Louboutin outlet mean, most skaters can only die when they see Cheap Tiffany Bracelets.
Retro jordans are perfect for spring, contains many popular elements, so that the last time the Jumpman23 shoes is too long. Make sure to grab yours quickly, as soon as they buy the Cheap Jordans Sale.

Replied

You'll locate nike nfl

You'll locate nike nfl jerseys china Ravens nfl jerseys cheap Jerseys that authentic NFL jerseys and all kinds of NFL crew goods are discounted, http://www.cheapravenjerseytop.com womens ravens jerseys at times by as much custom 49ers jerseys as 50% or more. So whether you are looking for hats, shirts, jackets or nearly anything else, now is the time to act.
Also, besides attire you are going to also come across all types of other items Baltimore Ravens Jerseys Cheap in this cheap NFL equipment sale. For instance, you are going Nike Ravens Jerseys to locate bedding, youth ravens jerseys flasks, cups and mugs, automobile accessories and additional. What ever it is you can find it and come across it for a fantastic 49ers Jerseys sale price tag. Of course you can also find a big array of Super Bowl objects as nicely, celebrating the Saints and San Francisco 49ers Jerseys womens 49ers jerseys Cheap their victory. nike nfl jerseys This sort of option merely is not accessible in the center of the football yr.

So the time to act is now if you are looking to Cheap 49ers Jerseys take edge of the fantastic, reduced charges on low cost NFL goods offered for the duration of the off-time. Retailers need to unload their stock, and they want to motivate enthusiasts to act when they usually may not treatment. cheap nike nfl jerseys That implies that you can acquire some amazing low-cost new nfl jerseys NFL equipment at deep discounts for the Baltimore Ravens Jerseys full loved ones, what ever it custom ravens jerseys is that you're searching for and whoever it is that you root for.
Very first of all, for those whom are not put youth 49ers jerseys at the current of the Method in http://www.cheap49ersjerseystop.com the entire we ought to clarify that first NASCAR signify: National Stock Auto Automobile Racing. It is just one of the most funds-producing sports in the region million San Francisco 49ers Jerseys above million is sold with the proper low cost tickets of NASCAR.
The cup of NASCAR Nextel is the second most viewed sport soon after the NFL. Can not assume it? go right to their website and you officially will be astounded with billion visits which it receives annually.
During the year of NASCAR you can see how the supporters of race surrounded the methods of race to Cheap Ravens Jerseys observe this celebration of m&eacutega and the resale of these tickets are a single of the largest enterprise on line currently.
The cup of Nextel is composed of 26 weekly races and of a type courses of 10 races. Only the initial year can obtain all Nike 49ers Jerseys viewers that the superbowl collects in its complete period. But not to deceive your self, it is not a activity of men only, actually just about half of the fans of NASCAR are gals, which nevertheless beats the woman attendance that the NFL or the MLB have jointly.
Due to the fact we explained they are organizations of m&eacutega. You can see the methods of race entirely full of names of the big companion you can picture. Every single sponsor have to pay out outside 1.5 about million greenback to have the privilege to see his title on a major automobile of race of Nextel. It is a aspiration occur true for gurus from sale, not other marks of sport its trustworthy mark of supporters like it does NASCAR. Therefore if this awoke your curiosity in excessive cases to buy your ticket and to see for on your own then you should hurry right up until get a bundle of ticket of NASCAR.

Replied

Before when I was studying

Before when I was studying PHP, I always miss use the single quote and double quote, and to know that they really have different purpose but since when I read this blog post I got to know everything about this. Thanks for your wonderful blog post. - buy fast youtube views
get youtube views fast

Replied

A PHP changeable is placed

A PHP changeable is placed inside a string that is restricted with single quotes, and the alike variable is placed within a string with double quotes. http://www.quotesable.com/holi-quotes

Replied

I wanted to inform you for

I wanted to inform you for this great help!! I definitely enjoyed every little bit of it. I have you bookmarked to check out new stuff on this post.
visit my site !!
think about !!
informal !!

Replied

Short quotes are really been

Short quotes are really been used by many of us as they gives us some hope or encouragement,as these are not just simple words they have strong meanings.

http://www.websmsmessages.com/quotes/Cute-Quotes.php

Replied

Yes it is. Php makes a

Yes it is. Php makes a distinction between single and double quotes.
prescription dispensing

Replied

Rush to Chiropractic Austin

Rush to Chiropractic Austin if you are tormented from stiff muscles and joints or numbness in your body. Get healed with significant results through natural treatments of Chiropractor Austin without undergoing any operation. Austin Chiropractor magical remedies will rid you of all the agonies in your body that's making your life harder.