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
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 '_').
Tags
Return values
string —The converted snake_case (or custom delimiter) string.