在PHP中对对象数组进行排序

时间:2017-06-09 13:32:52

标签: php arrays multidimensional-array

我需要一些帮助来排序这个对象数组:

Array
    (
    [0] => stdClass Object
    (
        [registrationType] => payment
        [registry] => 1
    )

    [1] => stdClass Object
    (
        [registrationType] => payment
        [registry] => 0
    )

    [2] => stdClass Object
    (
        [registrationType] => payment
        [registry] => 0
    )

    [3] => stdClass Object
    (
        [registrationType] => bankWithdrawal
        [registry] => 0
    )

    [4] => stdClass Object
    (
        [registrationType] => payment
        [registry] => 0
    )

    [5] => stdClass Object
    (
        [registrationType] => depoitBank
        [registry] => 1
    )

    [6] => stdClass Object
    (
        [registrationType] => cashing
        [registry] => 0
    )

    [7] => stdClass Object
    (
        [registrationType] => cashing
        [registry] => 1
    )

    [8] => stdClass Object
    (
        [registrationType] => cashing
        [registry] => 0
    )
)

我需要这样排序:

  1. 首先,我希望按照
  2. 这样的顺序对其进行排序

    (兑现,存款银行,银行取款,付款)

    1. 然后兑现和付款应按照
    2. 这样的注册表进行分类

      (兑换[登记0],兑现[有登记1]存款银行,银行取款,付款[有登记0],付款[有登记1])

      最终结果应为:Array([1],[2],[4],[0],[5],[3],[6],[8],[7])

0 个答案:

没有答案