Of course, you can change any zval containers that you created within your function, but you mustn 't change any zval s that refer to Zend-internal data!
If your function accepts arguments passed by reference that you intend to modify, you need to take some precautions.