note 74441 deleted from function.preg-replace by colder
| From: | colder@php.net | Date: | Wed, 11 Apr 2007 16:43:50 +0000 |
| Subject: | note 74441 deleted from function.preg-replace by colder | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-125301@lists.php.net to get a copy of this message | ||
Note Submitter: kurtubba at gmail dot com
Reason: bad code
----
- Make the first letter of a sentence capital and the rest small,
old trick with less code...not sure it's safe though.
- It will search for the first alphabetic letter,
even if the sentence doesn't start with one.
<?php
#usage $mySentence = sentalize($mySentence );
function sentalize($str){
return preg_replace('/([a-z])(.*)$/ie',
"strtoupper('\\1').strtolower('\\2')",$str);
}
?>