RE: [PHP] Change 'key' names of an associative array.
| From: | Mark Maggelet | Date: | Tue, 15 May 2001 21:45:56 +0000 |
| Subject: | RE: [PHP] Change 'key' names of an associative array. | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-52938@lists.php.net to get a copy of this message | ||
reset($array);
while(list($key,$value)=each($array)){
$array[strtoupper($key)]=$value;
unset $array[$key];
}
On Tue, 15 May 2001 16:19:41 -0400, Altunergil, Oktay
(oktay@forsoftinc.com) wrote:
>Yes. But I want to change the name of the key, not the value. Plus I
>want to
>be able to do this without creating an extra key/value pair for each
>conversion I do.
>
>oktay
>
>-----Original Message-----
>From: Jack Dempsey [mailto:dempsejn@georgetown.edu]
>Sent: Tuesday, May 15, 2001 4:22 PM
>To: Altunergil, Oktay; php-general@lists.php.net
>Subject: RE: [PHP] Change 'key' names of an associative array.
>
>
>have you tried
>http://www.php.net/manual/en/function.strtoupper.php
>
>-jack
>
>-----Original Message-----
>From: Altunergil, Oktay [mailto:oktay@ForSoftInc.com]
>Sent: Tuesday, May 15, 2001 4:15 PM
>To: php-general@lists.php.net
>Subject: [PHP] Change 'key' names of an associative array.
>
>
>
>I have been trying to convert a MySQL application to Oracle. Oracle
>needs
>the field names to be upper case.
>For this reason even if I can fetch the result row, I can't access
>it by
>$row[name] because I have to do
>$row[NAME].
>
>
>Is there a way to change the the key name to upper case, without
>making a
>copy.? (I mean without creating another array key with the same name
>in
>upper case)
>
>Thanks.
>
>Oktay Altunergil
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
>For additional commands, e-mail: php-general-help@lists.php.net
>To contact the list administrators, e-mail: php-list-
>admin@lists.php.net
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
>For additional commands, e-mail: php-general-help@lists.php.net
>To contact the list administrators, e-mail: php-list-
>admin@lists.php.net