snake.php
Table of Contents
Functions
- snake() : string
- Converts a string to snake_case (or a custom delimiter).
Functions
snake()
Converts a string to snake_case (or a custom delimiter).
snake(string|null $source[, string $delimiter = '_' ][, string|null $encoding = 'UTF-8' ]) : string
This function transforms camelCase, PascalCase, and space-separated words into snake case or any delimiter specified.
It uses an internal cache (via SnakeCache) to optimize repeated calls with the same input.
The cache can be flushed by calling SnakeCache::flush().
Parameters
- $source : string|null
-
The input string to convert.
- $delimiter : string = '_'
-
The delimiter to use (default is underscore '_').
- $encoding : string|null = 'UTF-8'
-
The encoding parameter is the character encoding. If it is omitted or null, the internal character encoding value will be used.
Tags
Return values
string —The converted snake_case (or custom delimiter) string.