Jesus · Bible · HTML · CSS · JS · PHP · SVG · Applications

mb_convert_case

Description

Perform case folding on a string

Syntax

mb_convert_case(
    string $string,
    int $mode,
    ?string $encoding = null
): string

Parameters

string

The string being converted.

mode

The mode of the conversion. It can be one of:

ConstantDescription
MB_CASE_UPPERUPPERCASE with full case-mapping (multiple characters)
MB_CASE_LOWERlowercase with full case-mapping (multiple characters)
MB_CASE_TITLETitlecase with full case-mapping (multiple characters)
MB_CASE_FOLDfoldcase (caseless) with full case-mapping (multiple characters)
MB_CASE_UPPER_SIMPLEUPPERCASE with simple case-mapping (single characters)
MB_CASE_LOWER_SIMPLElowercase with simple case-mapping (single characters)
MB_CASE_TITLE_SIMPLETitlecase with simple case-mapping (single characters)
MB_CASE_FOLD_SIMPLEfoldcase (caseless) with simple case-mapping (single characters)

encoding

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

Return

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

Examples

1 · string mode · MB_CASE_UPPER

<?

$string = "CASE case Case ß";
$mode = MB_CASE_UPPER;

$return = mb_convert_case($string, $mode);

echo $return;

?>
CASE CASE CASE SS

2 · string mode · MB_CASE_LOWER

<?

$string = "CASE case Case ß";
$mode = MB_CASE_LOWER;

$return = mb_convert_case($string, $mode);

echo $return;

?>
case case case ß

3 · string mode · MB_CASE_TITLE

<?

$string = "CASE case Case ß";
$mode = MB_CASE_TITLE;

$return = mb_convert_case($string, $mode);

echo $return;

?>
Case Case Case Ss

4 · string mode · MB_CASE_FOLD

<?

$string = "CASE case Case ß";
$mode = MB_CASE_FOLD;

$return = mb_convert_case($string, $mode);

echo $return;

?>
case case case ss

5 · string mode · MB_CASE_UPPER_SIMPLE

<?

$string = "CASE case Case ß";
$mode = MB_CASE_UPPER_SIMPLE;

$return = mb_convert_case($string, $mode);

echo $return;

?>
CASE CASE CASE ß

6 · string mode · MB_CASE_LOWER_SIMPLE

<?

$string = "CASE case Case ß";
$mode = MB_CASE_LOWER_SIMPLE;

$return = mb_convert_case($string, $mode);

echo $return;

?>
case case case ß

7 · string mode · MB_CASE_TITLE_SIMPLE

<?

$string = "CASE case Case ß";
$mode = MB_CASE_TITLE_SIMPLE;

$return = mb_convert_case($string, $mode);

echo $return;

?>
Case Case Case ß

8 · string mode · MB_CASE_FOLD_SIMPLE

<?

$string = "CASE case Case ß";
$mode = MB_CASE_FOLD_SIMPLE;

$return = mb_convert_case($string, $mode);

echo $return;

?>
case case case ß

9 · encoding

<?

$string = "CASE case Case ß";
$mode = MB_CASE_UPPER;
$encoding = 'UTF-8';

$return = mb_convert_case($string, $mode, $encoding);

echo $return;

?>
CASE CASE CASE SS
HomeMenu