increment_string($str[, $separator = '_'[, $first = 1]])
| Parameters: |
|
|---|---|
| Returns: |
An incremented string |
| Return type: |
string |
Increments a string by appending a number to it or increasing the number. Useful for creating “copies” or a file or duplicating database content which has unique titles or slugs.
Usage example:
echo increment_string('file', '_'); // "file_1"
echo increment_string('file', '-', 2); // "file-2"
echo increment_string('file_4'); // "file_5"
Please login to continue.