PHP 8.5.0 Alpha 4 available for testing

Voting

: min(zero, eight)?
(Example: nine)

The Note You're Voting On

Alex Milkovskyi
10 years ago
Convert string to in camel-case, useful for class name patterns:
<?php
/**
* Convert string to in camel-case, useful for class name patterns.
*
* @param $string
* Target string.
*
* @return string
* Camel-case string.
*/
function toCamelCase($string){
$string = str_replace('-', ' ', $string);
$string = str_replace('_', ' ', $string);
$string = ucwords(strtolower($string));
$string = str_replace(' ', '', $string);
return
$string;
}
?>

Example:
toCamelCase(make_mE camel-case pLEase) will return:
MakeMeCamelCasePlease

<< Back to user notes page

To Top