John Comerford wrote:
Hi Folks, Is there a better way of doing the following: $Rows[] = array(); $currentRow = count($Rows) - 1; $Rows[$currentRow]['test'] = "this is a test"; Specifically I am wonder if I can avoid having to use 'count'.
1) The code above will produce a $currentRow of -1 which is probably not what you want.
2) If you actually mean that you have an array that contains items and you want the last one, used end (http://php.net/end).
3) I'm not really sure what the context is, but this is a very odd way of working with arrays. Either you already know the key or you don't. If you're just trying to append to the array you can do that with the following syntax... $Rows[] = array('test' => 'this is a test');
-Stut -- http://stut.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php