Doc #51858 [Com]: mb_convert_case example is not the best
| From: | dani88elx at gmail dot com | Date: | Wed, 19 May 2010 08:58:03 +0000 |
| Subject: | Doc #51858 [Com]: mb_convert_case example is not the best | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-4404@lists.php.net to get a copy of this message | ||
Edit report at http://bugs.php.net/bug.php?id=51858&edit=1
ID: 51858
Comment by: dani88elx at gmail dot com
Reported by: dani88elx at gmail dot com
Summary: mb_convert_case example is not the best
Status: Open
Type: Documentation Problem
Package: Documentation problem
PHP Version: Irrelevant
New Comment:
sh**! last line should be
echo mb_convert_case($str, MB_CASE_TITLE, "UTF-8"); // prints: Mary Had
A Little Lamb And She Loved It So
Previous Comments:
------------------------------------------------------------------------
[2010-05-19 10:52:16] dani88elx at gmail dot com
Description:
------------
Example on mb_convert_case() does not show the utility of the function,
since the sample text has no accents or special characters.
It will be useful a comparison with strtoupper() / strtolower()
I proppose the following better examples:
$str= "ThÃs is à tëxt with çpécýal châráctèrs";
echo strtoupper($str); //prints a corrupted text in UTF: TH�S IS
� T�XT WITH �P�C�AL
CH�R�CT�RS
echo mb_convert_case($str, MB_CASE_UPPER, "UTF-8"); // prints a valid
upper case conversion in UTF: THÃS IS Ã TÃXT WITH ÃPÃCÃAL
CHÃRÃCTÃRS
$str = "mary had a Little lamb and she loved it so";
echo = mb_convert_case($str, MB_CASE_TITLE, "UTF-8"); // prints: Mary
Had A Little Lamb And She Loved It So
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=51858&edit=1