Automattic\WooCommerce\Blueprint

Util::snake_to_camelpublic staticWC 1.0

Convert a string from snake_case to camelCase.

Method of the class: Util{}

No Hooks.

Returns

String.

Usage

$result = Util::snake_to_camel( $string_to_convert );
$string_to_convert(string) (required)
The string to be converted.

Util::snake_to_camel() code WC 9.9.5

public static function snake_to_camel( $string_to_convert ) {
	// Split the string by underscores.
	$words = explode( '_', $string_to_convert );

	// Capitalize the first letter of each word.
	$words = array_map( 'ucfirst', $words );

	// Join the words back together.
	return implode( '', $words );
}