note 78040 deleted from function.str-split by crell
| From: | crell@php.net | Date: | Wed, 29 Jun 2022 18:28:57 +0000 |
| Subject: | note 78040 deleted from function.str-split by crell | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-218680@lists.php.net to get a copy of this message | ||
Note Submitter: Sam
----
A good way to use this method to convert CamelCase text into nice text would be-
<?php
/**
Returns a formatted string based on camel case.
e.g. "CamelCase" -> "Camel Case".
*/
function FormatCamelCase( $string ) {
$output = "";
foreach( str_split( $string ) as $char ) {
strtoupper( $char ) == $char and $output and $output .= " ";
$output .= $char;
}
return $output;
}
?>