scusa mi era sfuggito
aggiungici or is_string($tipo)