WP_Interactivity_API::kebab_to_camel_case
Transforms a kebab-case string to camelCase.
Method of the class: WP_Interactivity_API{}
No Hooks.
Returns
String. The transformed camelCase string.
Usage
// private - for code of main (parent) class only $result = $this->kebab_to_camel_case( $str ): string;
- $str(string) (required)
- The kebab-case string to transform to camelCase.
Changelog
| Since 6.5.0 | Introduced. |
WP_Interactivity_API::kebab_to_camel_case() WP Interactivity API::kebab to camel case code WP 7.0
private function kebab_to_camel_case( string $str ): string {
return lcfirst(
preg_replace_callback(
'/(-)([a-z])/',
function ( $matches ) {
return strtoupper( $matches[2] );
},
strtolower( rtrim( $str, '-' ) )
)
);
}