rustyofco Posted November 17, 2006 Share Posted November 17, 2006 My array goes like this:[code]$array[1][a] = 8253EF$array[1][b] = joe$array[2][a] = 2016HG$array[2][b] = bob$array[3][a] = 5768NT$array[3][b] = adam[/code]I want to sort it so that the item in the [a] key goes ascending alphabetically (alphanumerically), but it stays with its associated name (the b key).So in the end, I want [code]$array[1][a] = 2016HG$array[1][b] = bob$array[2][a] = 5768NT$array[2][b] = adam$array[3][a] = 8253EF$array[3][b] = joe[/code]What function is this? Quote Link to comment Share on other sites More sharing options...
Barand Posted November 17, 2006 Share Posted November 17, 2006 In this instance[code]<?php$array[1]['a'] = '8253EF';$array[1]['b'] = 'joe';$array[2]['a'] = '2016HG';$array[2]['b'] = 'bob';$array[3]['a'] = '5768NT';$array[3]['b'] = 'adam';array_multisort($array) ;echo '<pre>', print_r($array, true), '</pre>';?>[/code] Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.