On Tue, 11 Sep 2001 10:23, Evan Nemerson wrote:
> 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
There are a couple of functions that might suit your needs - array_keys()
which will return an array of the key names, or a combination of list and
each. Have a browse through the Array Functions section of the manual.
--
David Robley Techno-JoaT, Web Maintainer, Mail List Admin, etc
CENTRE FOR INJURY STUDIES Flinders University, SOUTH AUSTRALIA
"I'd give that hornet a 10," Tom said beratingly.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]