---
updatedAt: 2025-05-20T20:28:53.000Z
agentTools:
  projectIndex: https://docs.documotor.com/llms.txt
---

# ends_with

Check if a string ends with a given suffix

# Definition

`boolean ends_with(string $subject, string $suffix)`

Checks if `$subject` ends with `$suffix`.

# Parameters

<Glossary>string</Glossary> `$subject`

The string to check the ending of.

<Glossary>string</Glossary> `$suffix`

The suffix for which the string is checked.

# Returns

<Glossary>boolean</Glossary>

`true` if `$subject` ends with `$suffix`, otherwise `false`.

# Examples

```text Transformation
{
    a: ends_with('Hello, world', 'world'),
    b: ends_with('Hello, world', 'hello'),
    c: ends_with('Hello, world', 'd'),
    d: ends_with('Hello, world', ''),
    e: ends_with('Hello, world', `null`)      // Error
}
```

```json Result
{
  "a": true,
  "b": false,
  "c": true,
  "d": true
}
```