Use php's alloc functions