migrant php useful functions to obj-c