note 117270 added to function.ucwords
| From: | AlexMilkovskyi | Date: | Wed, 13 May 2015 09:23:00 +0000 |
| Subject: | note 117270 added to function.ucwords | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-202510@lists.php.net to get a copy of this message | ||
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
----
Server IP: 72.52.91.14
Probable Submitter: 84.112.182.213
----
Manual Page -- http://php.net/manual/en/function.ucwords.php
Edit -- https://master.php.net/note/edit/117270
Del: integrated -- https://master.php.net/note/delete/117270/integrated
Del: useless -- https://master.php.net/note/delete/117270/useless
Del: bad code -- https://master.php.net/note/delete/117270/bad+code
Del: spam -- https://master.php.net/note/delete/117270/spam
Del: non-english -- https://master.php.net/note/delete/117270/non-english
Del: in docs -- https://master.php.net/note/delete/117270/in+docs
Del: other reasons-- https://master.php.net/note/delete/117270
Reject -- https://master.php.net/note/reject/117270
Search -- https://master.php.net/manage/user-notes.php