Re: Question on using an array

From: Date: Wed, 28 Feb 2001 16:09:49 +0000
Subject: Re: Question on using an array
References: 1  Groups: php.windows 
Request: Send a blank email to php-windows+get-5757@lists.php.net to get a copy of this message
You could try accesing by value number, instead of using value index name. Anyway, I fear that what you're doing is quite illegal, and what is really happening is that when you assign the first 'links.php', it is overwritten by the second assignment, which is in turn overwritten by the third. Try sizeof() and check if you're having 8, or only 6 elements in the array. If the answer is 6... I think you might be in for some re-writing. :( You could probably use a bidimensional array, accesing by index number and retrieveng the two columns of data from it... or something like it. Gonzalo. > I have an array which looks something like this: > $arr_links = array('is/' => 'Information Systems' > ,'hr/' => 'Human Resources' > ,'planning/' => 'Planning Commission' > ,'boe/' => 'Board of Elections' > ,'vsc/' => 'Veterans\' Commission' > ,'links.php' => 'Park District ' > ,'links.php' => 'CSEA' > ,'links.php' => 'County Sheriff'); > and a directory builder that uses a while loop like this > while ( list($key, $val) = each($arr_links) ) { > //do a lot of stuff > } > I just added the last three entries on the array which all have the same key > (could be my obvious problem...) My problem is that the while loop only hits > the LAST of the three 'links.php' entry... > Any suggestions on how to force it to hit all of those entries? > pleasepleasepleaseplease don't tell me I have to rewrite the whole thing > with the keys/values reversed... > thanks in advance, > John > --------------------- > John Asendorf - jasendorf@lcounty.com > Web Applications Developer > http://www.lcounty.com - NEW FEATURES ADDED DAILY! > Licking County, Ohio, USA > 740-349-3631 > Aut insanit homo, aut versus facit

« previous php.windows (#5757) next »