How to do Type Conversion in PHP