The answer lies in how much you can comprehend about PHP internals (C language).
All PHP variables are zval's (a C structure). If you look at the _zval_struct C structure, you'll see that there are a bunch of extra bytes (variables) used to store information about each PHP variable. For instance, is_ref indicates whether this zval actually holds data or is simply a reference to another zval that holds data. Another interesting variable is the refcount. You can read about it in Figure 9-6, but basically when a variable falls out of scope, or when the variable is destroyed, its reference count is decremented by one. When the refcount reaches zero, it is picked up by the garbage collection system and its contents will be freed.
hth.
EDIT:
When I said "falls out of scope" I mean like when a variable is defined in a function and that function is returned from (ends).
FYI - See debug_zval_dump() function.
.