Automattic\WooCommerce\Blueprint
Util::snake_to_camel
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() Util::snake to camel code WC 10.8.1
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 );
}