note 61563 added to function.mb-convert-case

From: Date: Tue, 07 Feb 2006 02:02:16 +0000
Subject: note 61563 added to function.mb-convert-case
Groups: php.notes 
Request: Send a blank email to php-notes+get-103148@lists.php.net to get a copy of this message
This function is a bit more flexible than using mb_convert_case with MB_CASE_TITLE, because it lets you add words whose case you don't want modified. function title_case($string, $exceptions = array('to', 'a', 'the', 'of', 'I', 'II', 'III', 'IV', 'V', 'VI', 'VII', 'VIII', 'IX', 'X')) { $words = split(" ", $string); $newwords = array(); foreach ($words as $word) { if (!array_key_exists($word, $exceptions)) { $word = strtolower($word); $word = ucfirst($word); } array_push($newwords, $word); } return ucfirst(join(" ", $newwords)); } ---- Server IP: 203.16.234.91 Probable Submitter: 203.32.87.250 (proxied: unknown) ---- Manual Page -- http://www.php.net/manual/en/function.mb-convert-case.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+61563 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+61563&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+61563&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+61563&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+61563&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+61563&report=yes&reason=non-english Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+61563&report=yes&reason=already+in+docs Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+61563&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+61563&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#103148) next »