key.php
Table of Contents
Functions
- key() : string
- Returns a transformed key by optionally prepending a prefix.
Functions
key()
Returns a transformed key by optionally prepending a prefix.
key(string $key[, string|null $prefix = '' ][, string $separator = '.' ]) : string
This function allows you to prefix a key string with another string, separated by a custom separator. If the prefix is empty or null, the original key is returned unchanged.
Parameters
- $key : string
-
The key to transform.
- $prefix : string|null = ''
-
Optional prefix to prepend. Default is an empty string.
- $separator : string = '.'
-
The separator to use between the prefix and key. Default is '.'.
Tags
Return values
string —The transformed key. If prefix is provided, returns "prefix{separator}key", otherwise returns the original key.