Why not using `in_array()` here for match:

```php
                $field_types = array('text', 'password', 'color', 'date', 'datetime'
                        , 'datetime-local', 'email', 'month', 'range', 'number', 'search'
                        , 'tel','time','url', 'week');
                if(in_array($type, $field_types, true))
```