Posts in 'PHP'
1
PHP Single vs. Double Quotes
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").
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:
Time 1: 5.9485120773315 ($c = "test " . $i; )
Time 2: 7.0326972007751 ($c = "test $i"; )
Time 3: 5.9164550304413 ($c = 'test ' . $i; )
It's clear that embedding variables in strings is less efficient, but the difference between normal single-vs-...
Posted on February 7, 2010
Posted under PHP by Erik Hansen
Search
Categories
- Design (3)
- Development (9)
- Magento Development (26)
- PHP (1)
- Security (0)
- E-Commerce (5)
- General Business (5)
- Llama Culture (2)
- Magento (55)
- Management (4)
- Wiz (2)
- Online Marketing (1)
- Productivity (2)
- Uncategorized (4)