The Cache: Technology Expert's Forum
 
*
Welcome, Guest. Please login or register. September 18, 2019, 12:55:56 AM

Login with username, password and session length


Pages: [1]
  Print  
Author Topic: single quotes and newlines  (Read 2163 times)
jammaster82
Lifer
*****
Offline Offline

Posts: 666


Thats craigs list for ya


View Profile
« on: May 10, 2008, 10:58:48 AM »

Okay so i just found out that \n for new line
does not work if you are using single quotes,
it does if  you use double quotes however.

So what is the huge difference and why would
i ever not need to use double quotes?

 Huh?
Logged

The watched pot, never boils... But if you walk away from it , the soup burns.  What gives?
perkiset
Olde World Hacker
Administrator
Lifer
*****
Offline Offline

Posts: 10096



View Profile
« Reply #1 on: May 10, 2008, 11:19:40 AM »

single quotes are static strings and are compiled into the code as is... so particularly if you're using something like APC and you have a lot of strings, it's faster. If you don't need to do any processing on the string, that's the best way to go.

Double quotes processes the string, dereferencing any variables and controls (like \r\n etc) so there is more overhead if you're doing a lot of them.

In most cases, it probably doesn't matter much, although I'm always about that because it tells ME that I am doing processing a string very quickly, and I'm an efficiency nut.
Logged

It is now believed, that after having lived in one compound with 3 wives and never leaving the house for 5 years, Bin Laden called the U.S. Navy Seals himself.
Pages: [1]
  Print  
 
Jump to:  

Perkiset's Place Home   Best of The Cache   phpMyIDE: MySQL Stored Procedures, Functions & Triggers
Politics @ Perkiset's   Pinkhat's Perspective   
cache
mart
coder
programmers
ajax
php
javascript
Powered by MySQL Powered by PHP Powered by SMF 1.1.2 | SMF © 2006-2007, Simple Machines LLC
Seo4Smf v0.2 © Webmaster's Talks


Valid XHTML 1.0! Valid CSS!