# Mask credit card number

While working with credit cards it often needed to mask the number or card holder name. Here's the class you may use for that purpose. It is possible to configure mask symbol and the length of shown chars.

```php
<?php

use Payum\Core\Security\Util\Mask;

echo Mask::mask("3456-7890-1234-5678");
// 3XXX-XXXX-XXXX-5678

echo Mask::mask("4567890123456789", "*");
// 4***********6789

echo Mask::mask("4928-9012-abcd-3456", null, 8);
// 4XXX-XXXX-abcd-3456
```

***

### Supporting Payum

Payum is an MIT-licensed open source project with its ongoing development made possible entirely by the support of community and our customers. If you'd like to join them, please consider:

* [Become a sponsor](https://github.com/sponsors/Payum)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://payum.gitbook.io/payum/mask-credit-card-number.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
