hyphenate.php
Table of Contents
Functions
- hyphenate() : string
- Converts a camelCase or PascalCase string to a hyphenated (kebab-case) string.
Functions
hyphenate()
Converts a camelCase or PascalCase string to a hyphenated (kebab-case) string.
hyphenate(string|null $source) : string
This is useful for transforming class names or identifiers into URL- or CSS-friendly format.
Examples:
- "helloWorld" → "hello-world"
- "HTMLParser" → "html-parser"
- "aTestString" → "a-test-string"
Parameters
- $source : string|null
-
The camelCase or PascalCase string to convert.
Tags
Return values
string —The hyphenated (kebab-case) string.