¡@

Home 

php Programming Glossary: is_ref

How foreach actually works

http://stackoverflow.com/questions/10057671/how-foreach-actually-works

in particular you should know what a refcount is and what is_ref means. foreach works with all kinds of traversables i.e. with.. instead only an addref will be done ref array array has is_ref 1 now foreach array as val ... Why Because any change of the.. current array Output 2 3 4 5 false Here we have the is_ref 1 case so the array is not copied just like above . But now..

Smarty (and other tpl ngins): assign and assign_by_ref

http://stackoverflow.com/questions/5794746/smarty-and-other-tpl-ngins-assign-and-assign-by-ref

why a SOMETHING_BIG a points to a zval with refcount 1 and is_ref 0 b a a and b both point to a zval with refcount 2 and is_ref.. 0 b a a and b both point to a zval with refcount 2 and is_ref 0 c a Now we have a problem c can't just point to the same zval.. just point to the same zval anymore because that zval has is_ref to 0 but we need one with is_ref 1. So The zval gets copied...