sort array

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • millw0rm@gmail.com

    sort array

    i got 2 array one holds the actual data n another is user generated
    sort order... how to sort array #1 according to array #2???? array
    shld be sorted according to sortorder

    Array #1
    (
    [0] =Array
    (
    [id] =1
    [sortorder] =2
    [name] =Windows XP
    )

    [1] =Array
    (
    [id] =2
    [sortorder] =1
    [name] =Windows Vista
    )

    [2] =Array
    (
    [id] =3
    [sortorder] =4
    [name] =Mac OSX
    )

    [3] =Array
    (
    [id] =4
    [sortorder] =>3
    [name] =Linux
    )

    )


    Array #2
    (
    [0] =Array
    (
    [sortorder] =2
    )

    [1] =Array
    (
    [sortorder] =1
    )

    [2] =Array
    (
    [sortorder] =4
    )

    [3] =Array
    (
    [sortorder] =3
    )

    )

  • Hendri Kurniawan

    #2
    Re: sort array

    array_multisort (http://au3.php.net/manual/en/functio...-multisort.php)

    Hendri Kurniawan

    millw0rm@gmail. com wrote:
    i got 2 array one holds the actual data n another is user generated
    sort order... how to sort array #1 according to array #2???? array
    shld be sorted according to sortorder
    >
    Array #1
    (
    [0] =Array
    (
    [id] =1
    [sortorder] =2
    [name] =Windows XP
    )
    >
    )
    >
    >
    Array #2
    (
    [0] =Array
    (
    [sortorder] =2
    )
    )
    >

    Comment

    Working...