Helper functions for working with PHP primitives