PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
ddragas
Forum Contributor
Posts: 445 Joined: Sun Apr 18, 2004 4:01 pm
Post
by ddragas » Tue Mar 13, 2007 11:23 am
is it possible to sort keys of array asc?
example
Array ( [0] => 2 [1] => 1 [4] => 4 )
should be
Array ( [0] => 2 [1] => 1 [2] => 4 )
regards
ddragas
hawleyjr
BeerMod
Posts: 2170 Joined: Tue Jan 13, 2004 4:58 pm
Location: Jax FL & Spokane WA USA
Post
by hawleyjr » Tue Mar 13, 2007 11:44 am
stereofrog
Forum Contributor
Posts: 386 Joined: Mon Dec 04, 2006 6:10 am
Post
by stereofrog » Tue Mar 13, 2007 1:40 pm
From your example I'm guessing you want to "renumber" the keys rather than sort them. Check [fphp]array_values[/fphp].
ddragas
Forum Contributor
Posts: 445 Joined: Sun Apr 18, 2004 4:01 pm
Post
by ddragas » Tue Mar 13, 2007 1:53 pm
Thank you all for reply