Log in

View Full Version : Resolved putting variables in quotes



james438
03-30-2010, 12:02 AM
which is better:
$ip=$db;
or

$ip="$db";

bluewalrus
03-30-2010, 12:24 AM
Could try processing it yourself http://blog.smileylover.com/calculation-your-php-processing-time-using-simple-counter/ I'm not sure off hand and it seems hard to google

james438
03-30-2010, 01:19 AM
I used the code you linked and found no difference.

This is the best that I could find from php.net on the subject: http://www.php.net/manual/en/language.types.string.php

djr33
03-30-2010, 02:48 AM
Never use extra steps when you don't need them-- it will take longer.

$x="$y" is VERY inefficient because everything in the quotes must be parsed then converted to a string (from a string variable), then copied.
$x=$y is just copying the value.

james438
03-30-2010, 03:12 AM
makes sense, thanks.