Re: [PEPr] Comment on Networking::Net_NTP

From: Date: Wed, 21 Jul 2004 17:08:03 +0000
Subject: Re: [PEPr] Comment on Networking::Net_NTP
References: 1 2  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-32213@lists.php.net to get a copy of this message
On Wed, 21 Jul 2004 12:06:50 -0400, Hans L <hans@velum.net> wrote: > > Justin Patrin (http://pear.php.net/user/justinpatrin) has commented on the proposal for > > Networking::Net_NTP. > > > > Comment: > > > > All of your double quoted strings should be single quoted strings as none of them need to > > be parsed for variables and such. > > > > Is this really legitimate? Every benchmark I've read suggests that > there is no actual difference to using single or double quoted strings > (provided that you are not actually embedding vars in the double-quoted > strings). > > I'd be happy to be wrong (I'd feel justified in having always used > single quotes myself). > PHP must be doing some strange things internally.... According to some tests I just ran (yes, of course they're completely made up), it doesn't really make a difference whether you use " or ' when there is no substitution in the string. I used both an direct and an eval() approach to make sure that re-parsing was simulated. (of course, there could have been some kind of cache....) and both single and double quotes were about the same. When strings were substituted, there was a significant speedup for single quotes. So I guess my conclusion here would be: always use single quotes, they're faster overall. I don't understand why they're not always faster, though.... This was tested in PHP 4.3.6 and PHP 5.0.0, BTW. -- DB_DataObject_FormBuilder - The database at your fingertips http://pear.php.net/package/DB_DataObject_FormBuilder paperCrane --Justin Patrin--

« previous php.pear.dev (#32213) next »