RE: [PHP] Case-insensitive indexes

From: Date: Wed, 28 Apr 2004 13:38:04 +0000
Subject: RE: [PHP] Case-insensitive indexes
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-184874@lists.php.net to get a copy of this message
You could write a recursive function in PHP that would traverse the array and use strtolower to make all array elements lower case. Something like this (tested briefly): function arrayToLower($array) { if (!is_array($array)) { return false; } foreach ($array as $key => $value) { if (is_array($value)) { $array[$key] = arraytoLower($value); } else { $array[$key] = strtolower($value); } } return $array; } If you wanted to make the array name itself lower-case you could do something like $_request =& $_REQUEST but the new variable will not be automatically global in scope. Out of curiosity is this old code you are maintaining? Jason -----Original Message----- From: Tumurbaatar S. [mailto:tumurbaatar@datacom.mn] Sent: Wednesday, April 28, 2004 12:42 AM To: php-general@lists.php.net Subject: [PHP] Case-insensitive indexes Is there a way to turn off case sensitivity of associative arrays? System arrays like $_REQUEST and arrays returned from 'fetch_array' db functions? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

« previous php.general (#184874) next »