implement string to number coercion in a more PHP way.