Edit report at http://bugs.php.net/bug.php?id=31058&edit=1

 ID:                 31058
 Comment by:         luis dot pessoa67 at ibest dot com dot br
 Reported by:        veeeee at gmail dot com
 Summary:            array_change_key_case recursive option
 Status:             Open
 Type:               Feature/Change Request
 Package:            *General Issues
 PHP Version:        5.0.2
 Block user comment: N

 New Comment:

another way to do it:



    function ack_r3(&$array, $case=CASE_LOWER, $flag_rec=false) 

    {

      $array = array_change_key_case($array, $case);

      if ( $flag_rec ) {

        foreach ($array as $key => $value) {

            if ( is_array($value) ) {

                ack_r3($array[$key], $case, true);

            }

        }

      }

    }



note that: ack_r3($array, $case, false) <=>
array_change_key_case($array, $case)


Previous Comments:
------------------------------------------------------------------------
[2010-09-24 10:27:41] ahar...@php.net

Re-requested in request #52917.

------------------------------------------------------------------------
[2004-12-10 21:53:24] veeeee at gmail dot com

Description:
------------
It would be quite handy were there an option (optional 3rd parameter) to
array_change_key_case so that it would recurse into multi-dimensional
arrays so one would not need to create work arounds such as:



function ack_r($array, $case) 

{

  $array = array_change_key_case($array, $case);

  foreach ($array as $key => $value) {

    if ( is_array($value) ) {

      $array[$key] = ack_r($value, $case);

    }

  }

  return $array;

}









------------------------------------------------------------------------



-- 
Edit this bug report at http://bugs.php.net/bug.php?id=31058&edit=1

Reply via email to