I have an array, and I want sort through and echo the results using foreach. However, on the last key of the array, I want to put a period at the end of the key before it is echoed. How would I do this?
You could do something like: foreach ($array as $id => $item){ // ... if ($id == (count($array)-1)){ // Add your period } } PHP: This should guide you a bit, hopefully. Jay
Thanks, it works The only downside is it goes like: $array = array( 1 => "value1", 2 => "value2", 3 => "value3", ); PHP: I'd rather use "key1" => "value1", but it is no biggie - it works anyway Thanks, BP ?>[/php]