I'm building some software that will be passing a string variable which could potentially be up to 125K bytes (characters) in size. I know that passing a reference to the variable will be much more efficient than copying the variable: copying, as I understand it: foo($var) [...later...] function foo ($myvar) { $sql = "insert into table (this) values (\"$myvar\")"; } passing by reference, not copying: foo($var) [...later...] function foo (&$myvar) { $sql = "insert into table (this) values (\"$myvar\")"; } A few questions: 1. Am I correct that PHP makes a copy of the variable when I call the function with the variable, since the scope will not be global in the function (unless I declare it such)? 2. Will I be saving some CPU cycles and memory by passing by reference? 3. Is my pseudo code above correct? If not, can you show me how one might pass by reference correctly? I've tested both pieces of code, but can't determine if there is a speed/memory difference, and I don't actually have 125K in data handy! Thanks, Peter --------------------------------------------------------------------------- Peter Beckman Systems Engineer, Fairfax Cable Access Corporation beckman@purplecow.com http://www.purplecow.com/ --------------------------------------------------------------------------- -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php