Re: Arrays passed to functions lose their indexing - how to maintain?

From: Date: Fri, 09 Jul 2010 19:55:34 +0000
Subject: Re: Arrays passed to functions lose their indexing - how to maintain?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-306800@lists.php.net to get a copy of this message
On Fri, 2010-07-09 at 15:55 -0400, Marc Guay wrote: > Hi folks, > > I have an array that looks a little something like this: > > Array ( [6] => 43.712608, -79.360092 [7] => 43.674088, -79.388557 [8] > => 43.674088, -79.388557 [9] => 43.704666, -79.397873 [10] => > 43.674393, -79.372147 ) > > but after I pass it to a function, it loses it's indexing and becomes: > > Array ( [0] => 43.712608, -79.360092 [1] => 43.674088, -79.388557 [2] > => 43.674088, -79.388557 [3] => 43.704666, -79.397873 [4] => > 43.674393, -79.372147 ) > > The indexing is important and I'd like to hang onto it. Any ideas? "pointers"? > > Marc > Are you passing the array variable by reference? If so, it's probably the logic of the function that is re-writing the keys. What does the function look like? Thanks, Ash http://www.ashleysheridan.co.uk

« previous php.general (#306800) next »