Hey,

I want sort an associative array of string.

such as
array(
[hotel]=>array(
[name]='Royal Cabin'
),

[hotel]=>array(
[name]='macdonald court'
))

etc...

what want is to sort the above array to a given string such as 'ro' or 'mac'
wher the array is sorted and show the closet match in the array first, and listing others after that

Please help me on this. Thanks in adnace.

Hey,

I want sort an associative array of string.

such as
array(
[hotel]=>array(
[name]='Royal Cabin'
),

[hotel]=>array(
[name]='macdonald court'
))

etc...

what want is to sort the above array to a given string such as 'ro' or 'mac'
wher the array is sorted and show the closet match in the array first, and listing others after that

Please help me on this. Thanks in adnace.

always remember php.net for function other than daniweb and must remember almost all languages have ksort,sort like function to sort the array

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.