# $field->toInt()

Converts the field value into a proper integer

****

- Source: <https://github.com/getkirby/kirby/tree/5.5.3/config/methods.php#L189>

****

```php
$field->toInt(int $default = 0): int
```

## Parameters

| Name | Type | Default | Description |
| ---- | ---- | ---- | ---- |
| `$default` | `int` | – | Default value if the field is empty |

## Return type

`int`

This method modifies the existing `$field` object it is applied to and returns it again.

## Aliases

You can use the following aliases for this field method in your template:

- `$field->int(…)`

## Examples

```php
<?= $page->mynumber()->toInt() ?>
```