When the reference counter reaches 0, no references exist to this value anymore, which causes automatic freeing of the value.
To access a long you access zval.value.lval, to access a double you use zval.value.dval, and so on. Because all values are stored in a union, trying to access data with incorrect union members results in meaningless output.