> ## Documentation Index
> Fetch the complete documentation index at: https://reportana.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# sort

### Introduction

The `sort` filter is used to sort arrays or sequences of values in ascending order. It is useful when you need to ensure that items are displayed in a specific sequence, such as listing products by price or organizing names alphabetically.

### Example of Use

Example of how to use the `sort` filter to sort an array of numbers:

```twig theme={null}
{% set numbers = [5, 3, 9, 1, 4] %}

{{ numbers|sort|json_encode }}
```

In this example, the `sort` filter sorts the `numbers` array in ascending order. The result will display the numbers arranged in increasing sequence. To facilitate viewing and sending the data via WhatsApp, we use `json_encode` together to convert the sorted array into a JSON string.

### Output Example of the Code

<img src="https://mintcdn.com/reportana/rrUbVfAgCraOJwnY/sort-en.png?fit=max&auto=format&n=rrUbVfAgCraOJwnY&q=85&s=f616779e129ce1c846af38413389e8ec" alt="Result of `sort` Filter" width="899" height="239" data-path="sort-en.png" />
