Cloning Static Variable

../_images/cloning_static_variable.png

It is not possible to clone a static variable, but it is well possible to duplicate a closure which contains a static variable. Then, the variable is duplicated with its content at the time of cloning. So, it might be the default value, or it might be an subsequent value if the closure has already been used.

When the original closure is a first class callable, the moment of cloning does not matter.

See Also

PHP Features