Why do you need to convert between types? PHP is a weakly typed language and your code should take advantage of that - don't care about types if you don't have to.