Jump to content

Sorting Arrays


cheechm

Recommended Posts

Hi,

How would I sort these two arrays against each other?

 

Array
(
    [domain] => localhost
    [postcode] => SW10
    [name] => Point
    [company_name] => Point
    [shipping_username] => Nick
    [api_key] => ********
    [address] => London
    [subtitle] => Cool Test
    [phone] => 0777777
    [limit] => 10
    [delivery] => 1.50
    [email_confirm] => 1
    [online] => 1
    [seed] => 0dAfghRqSTgx
    [install_path] => /server/lhs/
)
Array
(
    [name] => 1
    [online] => 12
    [postcode] => 8
    [phone] => 6
    [address] => 7
    [delivery] => 11
    [subtitle] => 2
    [email_confirm] => 9
    [domain] => 3
    [install_path] => 4
    [seed] => 0
    [limit] => 10
    [api_key] => 14
    [shipping_username] => 13
    [company_name] => 5
)

 

You'll see in the second array for instance that [name] => 1 and [subtitle] => 2.. How in the first array would I order it so that is went:

    [name] => Point

    [subtitle] => Cool Test

...etc?

 

I tried array_multisort() but I don't think it is the right one? If it is I couldn't get it to work.

 

Thanks

Link to comment
Share on other sites

If I had an array like this:

 

Array
(
    [subtitle] => Array
        (
            [value] => Cool Test
            [name] => Subtitle
            [order] => 2
            [section] => 1
            [type] => 0
        )

    [domain] => Array
        (
            [value] => localhost
            [name] => Domain Name 
            [order] => 3
            [section] => 0
            [type] => 0
        )
)

 

How would I sort the array by order?

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.