note 102939 added to function.strtoupper
| From: | christoph dot hochstrasser at gmail dot com | Date: | Tue, 15 Mar 2011 16:12:00 +0000 |
| Subject: | note 102939 added to function.strtoupper | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-177911@lists.php.net to get a copy of this message | ||
For beginners: here is the most simple Camelize function for PHP. It converts underscore or dash
separated strings to camelCase, optionally with a Parameter to convert them to PascalCase (often
needed for Class names).
<?php
function camelize($string, $pascalCase = false)
{
$string = str_replace(array('-', '_'), ' ', $string);
$string = ucwords($string);
$string = str_replace(' ', '', $string);
if (!$pascalCase) {
return lcfirst($string);
}
return $string;
}
----
Server IP: 69.147.83.197
Probable Submitter: 90.146.58.218
----
Manual Page -- http://www.php.net/manual/en/function.strtoupper.php
Edit -- https://master.php.net/note/edit/102939
Del: integrated -- https://master.php.net/note/delete/102939/integrated
Del: useless -- https://master.php.net/note/delete/102939/useless
Del: bad code -- https://master.php.net/note/delete/102939/bad+code
Del: spam -- https://master.php.net/note/delete/102939/spam
Del: non-english -- https://master.php.net/note/delete/102939/non-english
Del: in docs -- https://master.php.net/note/delete/102939/in+docs
Del: other reasons-- https://master.php.net/note/delete/102939
Reject -- https://master.php.net/note/reject/102939
Search -- https://master.php.net/manage/user-notes.php