From dd7d5ae956b82ba6f5153ceaef6d468d87f2aec1 Mon Sep 17 00:00:00 2001 From: mohrt Date: Wed, 12 Mar 2003 00:14:32 +0000 Subject: [PATCH] update technical explanation of assign_by_ref and append_by_ref --- docs/programmers.sgml | 34 +++++++++++++--------------------- 1 file changed, 13 insertions(+), 21 deletions(-) diff --git a/docs/programmers.sgml b/docs/programmers.sgml index f8fd6cac..02987f55 100644 --- a/docs/programmers.sgml +++ b/docs/programmers.sgml @@ -548,22 +548,14 @@ $smarty->append(array("city" => "Lincoln","state" => "Nebraska")); - This is used to append values to the templates by reference instead of - making a copy. See the PHP manual on variable referencing for an - explanation. If you pass the optional third parameter of true, the value - will be merged with the current array instead of appended. + This is used to append values to the templates by reference. + If you append a variable by reference then change its + value, the appended value sees the change as well. For objects, + append_by_ref() also avoids an in-memory copy of the appended object. + See the PHP manual on variable referencing for an in-depth + explanation. If you pass the optional third parameter of true, + the value will be merged with the current array instead of appended. - - Technical Note - - append_by_ref() is more efficient than append() since it does not create - an in-memory copy of the variable. Instead it refers to the actual - variable in the memory heap. Be aware if you alter the original variable - after it is assigned, the assigned variable sees the changes! PHP 5.0 - will take care of referencing automatically, so this function acts as a - workaround. - - Technical Note @@ -626,12 +618,12 @@ $smarty->assign(array("city" => "Lincoln","state" => "Nebraska")); Technical Note - assign_by_ref() is more efficient than assign() since it does not create - an in-memory copy of the variable. Instead it refers to the actual - variable in the memory heap. Be aware if you alter the original variable - after it is assigned, the assigned variable sees the changes! PHP 5.0 - will take care of referencing automatically, so this function acts as a - workaround. + This is used to assign values to the templates by reference. + If you assign a variable by reference then change its + value, the assigned value sees the change as well. For objects, + assign_by_ref() also avoids an in-memory copy of the assigned object. + See the PHP manual on variable referencing for an in-depth + explanation.