WP_Interactivity_API::kebab_to_camel_case( string $str ): string

In this article

This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.

Transforms a kebab-case string to camelCase.

Parameters

$strstringrequired
The kebab-case string to transform to camelCase.

Return

string The transformed camelCase string.

Source

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, '-' ) )
		)
	);
}

User Contributed Notes

You must log in before being able to contribute a note or feedback.