note 26808 deleted from function.array-keys by googleguy
| From: | googleguy@php.net | Date: | Tue, 22 Oct 2013 09:05:16 +0000 |
| Subject: | note 26808 deleted from function.array-keys by googleguy | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-196894@lists.php.net to get a copy of this message | ||
Note Submitter: michielbakker at msn dot com
----
If you receive a bunch of variables and like to change most of them (or all of them for that
matter), you can do something like this: (data has been sent to a page with POST)
<?php
$allKeys = array_keys($HTTP_POST_VARS);
for ($i=0;$i<count($allKeys);$i++)
{
$$allKeys[$i] = strtoupper($HTTP_POST_VARS[$allKeys[$i]]);
}
?>
This makes caracters (a-z) uppercase. This is just one way to use it, ofcourse.
Hope this helps someone understand the way to use array_keys() or give any ideas. :)