php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #62127 array_change_key_case first letter
Submitted: 2012-05-23 17:03 UTC Modified: 2012-05-24 10:19 UTC
From: michael at hscbrasil dot com dot br Assigned:
Status: Not a bug Package: Arrays related
PHP Version: Irrelevant OS: CentOS 5.5
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
32 + 22 = ?
Subscribe to this entry?

 
 [2012-05-23 17:03 UTC] michael at hscbrasil dot com dot br
Description:
------------
I was trying to use array_change_key_case to convert Array keys to a Lower Case. An error occurs in keys with accent on the first letter.

PHP Version 5.2.10

Test script:
---------------
$arr = array
(
	'Última Atualização' => 'Última Atualização',
	'IP' => 'IP',
	'Ônibus' => 'Ônibus',
	'MSN' => 'MSN'
);

print 'normal = '.var_export($arr, true);

print 'lower = '.var_export(array_change_key_case($arr, CASE_LOWER), true);

/*
normal = array (
  'Última Atualização' => 'Última Atualização',
  'IP' => 'IP',
  'Ônibus' => 'Ônibus',
  'MSN' => 'MSN',
)
lower = array (
  'Última atualização' => 'Última Atualização',
  'ip' => 'IP',
  'Ônibus' => 'Ônibus',
  'msn' => 'MSN',
)
*/


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-05-24 10:19 UTC] johannes@php.net
-Status: Open +Status: Not a bug
 [2012-05-24 10:19 UTC] johannes@php.net
Set a proper locale using setlocale() also 5.2.10 is out of support for long
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 18 22:01:28 2024 UTC