mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-04 18:34:27 +02:00
update technical explanation of assign_by_ref and append_by_ref
This commit is contained in:
@@ -548,22 +548,14 @@ $smarty->append(array("city" => "Lincoln","state" => "Nebraska"));</programlisti
|
|||||||
</funcprototype>
|
</funcprototype>
|
||||||
</funcsynopsis>
|
</funcsynopsis>
|
||||||
<para>
|
<para>
|
||||||
This is used to append values to the templates by reference instead of
|
This is used to append values to the templates by reference.
|
||||||
making a copy. See the PHP manual on variable referencing for an
|
If you append a variable by reference then change its
|
||||||
explanation. If you pass the optional third parameter of true, the value
|
value, the appended value sees the change as well. For objects,
|
||||||
will be merged with the current array instead of appended.
|
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.
|
||||||
</para>
|
</para>
|
||||||
<note>
|
|
||||||
<title>Technical Note</title>
|
|
||||||
<para>
|
|
||||||
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.
|
|
||||||
</para>
|
|
||||||
</note>
|
|
||||||
<note>
|
<note>
|
||||||
<title>Technical Note</title>
|
<title>Technical Note</title>
|
||||||
<para>
|
<para>
|
||||||
@@ -626,12 +618,12 @@ $smarty->assign(array("city" => "Lincoln","state" => "Nebraska"));</programlisti
|
|||||||
<note>
|
<note>
|
||||||
<title>Technical Note</title>
|
<title>Technical Note</title>
|
||||||
<para>
|
<para>
|
||||||
assign_by_ref() is more efficient than assign() since it does not create
|
This is used to assign values to the templates by reference.
|
||||||
an in-memory copy of the variable. Instead it refers to the actual
|
If you assign a variable by reference then change its
|
||||||
variable in the memory heap. Be aware if you alter the original variable
|
value, the assigned value sees the change as well. For objects,
|
||||||
after it is assigned, the assigned variable sees the changes! PHP 5.0
|
assign_by_ref() also avoids an in-memory copy of the assigned object.
|
||||||
will take care of referencing automatically, so this function acts as a
|
See the PHP manual on variable referencing for an in-depth
|
||||||
workaround.
|
explanation.
|
||||||
</para>
|
</para>
|
||||||
</note>
|
</note>
|
||||||
<example>
|
<example>
|
||||||
|
Reference in New Issue
Block a user