<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Classy Llama Studios - Specializing in Magento eCommerce, Magento Development, and Magento Design &#187; PHP</title>
	<atom:link href="http://classyllama.com/category/development/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://classyllama.com</link>
	<description>Classy Llama Studios is a team of developers, designers and marketers specializing in Magento, Wordpress and Custom Web Application development.</description>
	<lastBuildDate>Sun, 18 Dec 2011 00:03:54 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>PHP Single vs. Double Quotes</title>
		<link>http://classyllama.com/development/php/php-single-vs-double-quotes/</link>
		<comments>http://classyllama.com/development/php/php-single-vs-double-quotes/#comments</comments>
		<pubDate>Sun, 07 Feb 2010 06:21:40 +0000</pubDate>
		<dc:creator>ehansen</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://classyllama.com/?p=294</guid>
		<description><![CDATA[For a long time, I've been a proponent of using single-quotes as opposed to double-quotes when assigning string literals (strings containing no variables) to a variable (eg:  $var = 'string'; VS $var = "string").]]></description>
			<content:encoded><![CDATA[<a href="http://classyllama.com/development/php/php-single-vs-double-quotes/" title="PHP Single vs. Double Quotes"><img src="http://classyllama.com/wp-content/uploads/2010/02/Screen-shot-2010-02-07-at-12.19.18-AM1-718x80.png" alt="" class="feed-image" /></a><p>For a long time, I&#8217;ve been a proponent of using single-quotes as opposed to double-quotes when assigning string literals (strings containing no variables) to a variable (eg:  $var = &#8217;string&#8217;; VS $var = &#8220;string&#8221;).</p>
<p>I just did some research to find out how much (if any) impact using single-vs-double quotes had on performance.  I took the code from this blog post: http://spindrop.us/2007/03/03/php-double-versus-single-quotes/ modified the MAX constant to 8,000,000 and then ran the test on our Nexcess server.  The results were fairly consistent:</p>
<p>Time 1: 5.9485120773315 ($c = &#8220;test &#8221; . $i;  )<br />
Time 2: 7.0326972007751 ($c = &#8220;test $i&#8221;;  )<br />
Time 3: 5.9164550304413  ($c = &#8216;test &#8216; . $i;  )</p>
<p>It&#8217;s clear that embedding variables in strings is less efficient, but the difference between normal single-vs-double quotes is negligible (at least on our server configuration with this test).</p>
<p>Despite the lack of clear performance benefits, I still think it best practice to use single-quotes when using string literals, as it denotes that a string doesn&#8217;t contain any variables.  One benefit of this is that when skimming code, you can more quickly process which variables are string literals vs strings with embedded variables.</p>
<p>The Zend Framework Coding Standard also recommends this practice: http://framework.zend.com/manual/en/coding-standard.coding-style.html</p>
]]></content:encoded>
			<wfw:commentRss>http://classyllama.com/development/php/php-single-vs-double-quotes/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

