WeberDev.com PHP and MySQL Code

LOG IN
BEGINNER GUIDES  |  PHP CLASSES  |  CODE SEARCH  |  ARTICLES SEARCH  |  PHP FORUMS  |  PHP MANUAL  |  PHP FUNCTIONS LIST  |  WEB SITE TEMPLATES
Start typing to search for PHP and MySQL Code Snippets and Articles Search
Submit a code Example / Snippet Submit Your Code
Search Engine Optimization Monitor SEO Monitor
Web Site UpTime Monitor UpTime Monitor
WeberDev's Monthly code contest PHP Code Contest
Your Personal Examples List My Favorite Examples
Your Personal Articles List My Favorite Articles
Edit Account Info Update Your Profile
PHP Code Search
Web Development Forums
Learn MySQL Playing Trivia
PHPBB2 Templates
Web Development Index
Web Development Resources
Web Development Content
PHPClasses
PHP Editor
PHP Jobs
Vision.To Design
Ajax Tutorials
PHP Programming Help
PHP/MySQL Programming
Webmaster Resources
Webmaster Forum
XML meta language
website builder
Mobile Dev World
Perform case folding on a string

mb_convert_case

(PHP 4 >= 4.3.0, PHP 5)

mb_convert_casePerform case folding on a string

Description

string mb_convert_case ( string $str , int $mode= MB_CASE_UPPER [, string $encoding= mb_internal_encoding() ] )

Performs case folding on a string, converted in the way specified by mode .

Parameters

str

The string being converted.

mode

The mode of the conversion. It can be one of MB_CASE_UPPER, MB_CASE_LOWER, or MB_CASE_TITLE.

encoding

The encoding parameter is the character encoding. If it is omitted, the internal character encoding value will be used.

Return Values

A case folded version of string converted in the way specified by mode .

Unicode

By contrast to the standard case folding functions such as strtolower() and strtoupper(), case folding is performed on the basis of the Unicode character properties. Thus the behaviour of this function is not affected by locale settings and it can convert any characters that have 'alphabetic' property, such as A-umlaut (Ä).

For more information about the Unicode properties, please see » http://www.unicode.org/unicode/reports/tr21/.

Examples

Example #1 mb_convert_case() example

<?php
$str 
"mary had a Little lamb and she loved it so";
$str mb_convert_case($strMB_CASE_UPPER"UTF-8");
echo 
$str// Prints MARY HAD A LITTLE LAMB AND SHE LOVED IT SO
$str mb_convert_case($strMB_CASE_TITLE"UTF-8");
echo 
$str// Prints Mary Had A Little Lamb And She Loved It So
?>

See Also


Convert number to words
Categories : PHP, Math., Arrays
A function to take a string and converts the first letter of all words to upper case
Categories : PHP, Strings
Convert a string to Title Case
Categories : Strings, PHP



Function to convert Arabic numbers into Roman Numerals
Categories : Algorithms, PHP, Date Time
convert a number (three digits) to written form (English & Spanish)
Categories : PHP, Algorithms
Returns the last row from a select where multiple rows have been selected. In this case it is used to determine the last number in an AUTO_INCREMENT column. I use it to create "ticket numbers" or anything that needs a unique ID in sequence.
Categories : mSQL, MySQL, Databases, PHP
sec2hms : Convert number of seconds to HH:MM:SS format
Categories : PHP, Date Time
Converts a string to Title Case
Categories : Algorithms, PHP
Show the steps for converting a number from a given base to base 10. Shows the steps involved in converting a number from a given base to base 10.
Categories : PHP, Math., Algorithms
Decimal to Fraction - A function that converts numbers with decimal remainders to numbers with fractional remainders.
Categories : PHP, Math.
File size with label - afunction that reads the filesize from a selected file and convert the number of bytes into KB, MB etc
Categories : PHP, Filesystem
Class for processing image (resizing the image size to create thumb nails and small images from actual image without loosing the aspect ratio of the image)
Categories : PHP, PHP Classes, Graphics
mysql date/time converters
Categories : PHP, MySQL, Databases, Date Time
Counting the number of words in user-supplied text
Categories : PHP, Strings