find out names of keys in an array
| From: | Evan Nemerson | Date: | Tue, 11 Sep 2001 00:53:10 +0000 |
| Subject: | find out names of keys in an array | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-66832@lists.php.net to get a copy of this message | ||
I'm writing a little script to make a stem plot (to make my AP STAT class
easier). Currently, my stem plot is stored in an array. Here is what the
output of print_r($stem); looks like:
Array
(
[39] => 7
[40] => 1 1 4 8 9
[41] => 2 3 8 8 9
[42] => 0 2 3 5 7
[43] => 0 0 1 3 4 7 8 9
[44] => 2 3 5
[45] => 0 4 6 8
[46] => 4 6 6
[47] => 0 0 3 3 6 6 7 7 8
[48] => 0 3 4
[49] => 2 2
[50] => 5 6
[51] => 1
)
I want to get the key names (in this case 39, 40, 41... 51) so I can get
their output individually. Even just getting the smallest and largest numbers
would work since I want the output to look like this (I added a 537):
39 | 7
40 | 1 1 4 8 9
41 | 2 3 8 8 9
42 | 0 2 3 5 7
43 | 0 0 1 3 4 7 8 9
44 | 2 3 5
45 | 0 4 6 8
46 | 4 6 6
47 | 0 0 3 3 6 6 7 7 8
48 | 0 3 4
49 | 2 2
50 | 5 6
51 | 1
52 |
53 | 7
Any ideas???
Evan Nemerson
PS If anyone wants this when im done email me. evan(a)coeus-group*com