On Aug 31, 2010, at 11:46 AM, Ashley Sheridan wrote:

> On Tue, 2010-08-31 at 11:46 -0400, Joshua Kehn wrote:
>> 
>> Quickest way I can think of would be to do something like
>> 
>> $tmp = array();
>> 
>> foreach($old_array as $key => $value)
>> {
>>      $tmp[$value] = $key;
>> }
>> 
>> But knowing PHP there is probably some array_reverse_keys() function.
>> 
>> Regards,
>> 
>> -Josh
>> ____________________________________
>> Joshua Kehn | josh.k...@gmail.com
>> http://joshuakehn.com
>> 
>> On Aug 31, 2010, at 11:43 AM, Tontonq Tontonq wrote:
>> 
>> > a quick question
>> > lets say i have an array like that
>> > 
>> > 
>> > Array
>> > (
>> > [300] => 300
>> > [301] => 301
>> > [302] => 302
>> > [303] => 303
>> > [304] => 304
>> > [305] => 305
>> > [306] => 306
>> > [307] => 307
>> > [308] => 308
>> > ...
>> > how can i change keys to 0,1,2,3,.. by faster way
>> > (it should like that) >
>> > Array
>> > (
>> >  [0] => 300
>> >  [1] => 301
>> >  [2] => 302
>> >  [3] => 303
>> >   ....
>> 
>> 
> 
> That doesn't actually answer the question, it just changes the key/value 
> pairs around. There is a built-in function for this in PHP, but it's not what 
> the OP asked for.
> 
> Thanks,
> Ash
> http://www.ashleysheridan.co.uk
> 
> 

I misread the question as flipping array keys, my mistake.

Regards,

-Josh
____________________________________
Joshua Kehn | josh.k...@gmail.com
http://joshuakehn.com

Reply via email to