Skip to content

Commit

Permalink
Add sprintf to the basic usage docs
Browse files Browse the repository at this point in the history
  • Loading branch information
SenseException committed May 31, 2024
1 parent 7c6d805 commit 7e731b9
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,20 @@ Exceptions.

You can catch every Exception of Intl-Format by using `Budgegeria\IntlFormat\Exception\IntlFormatException`.

### sprintf function

A custom implementation of the function `sprintf` can be used to format values to php's default locale:

```php

// If en_US is the default locale of php

$date = new DateTime();

echo Budgegeria\IntlFormat\sprintf('Today is %date_short', $date);
// "Today is 3/1/16"
```

## Predefined formats

Here are some lists of predefined type specifiers and their formats, that are already usable in Intl-Format.
Expand Down

0 comments on commit 7e731b9

Please sign in to comment.