# param()

Returns a single param from the URL

****

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

****

```php
param(string $key, string|null $fallback = null): string|null
```

## Parameters

| Name | Type | Default | Description |
| ---- | ---- | ---- | ---- |
| `$key` (required) | `string` | – | – |
| `$fallback` | `string` or `null` | `null` | – |

## Return types

`string` or `null`

## Examples

Besides with URL query variables, you can set parameters via URL in Kirby in a more human-readable way:

```
http://yourdomain.com/blog/tag:mytag/year:2018
```

Note that you have to use a semicolon instead of a colon on Windows systems. In your code, you can use the `url()` method with the `params` parameter to make sure that the resulting URL is compatible with both Linux and Windows servers, e.g.

```php
$url = url($path, ['params' => ['tag' => 'myTag']]);
```

Those parameters are very handy when you want to build URL-based filters for your content.

Such parameters will be ignored by the router so the URL which will be fetched by Kirby in this case is `http://yourdomain.com/blog`.

The parameters can be fetched in templates, snippets or controllers like this:

```php
$tag  = param('tag');
$year = param('year');
```

You can define a fallback value if a parameter is not set:

```php
$tag  = param('tag', 'design');
$year = param('year', 2018);
```

## Further reading

- <a href="https://getkirby.com/docs/cookbook/collections/filtering-with-tags">Filtering by tag</a>