Sıralama int ve metin değeri değeri olarak nesne

0 Cevap php

Ben bir nesne var ve bir sorun var, burada bu nesne ürünü $ Bu anahtarları (PRODUCT_TITLE, product_price, product_stock) ve daha fazla, ben PRODUCT_TITLE sonra sıralamak gerekir ve benim amacım bu ürün varsa ben doğru sıralamak değildir.

test product 1
test product 11
test product 111
test product 2
test product 20
test product 3
test product 33
test product 333

Onun bu gibi sıralamak için doğru yolu:

test product 1
test product 2
test product 3
test product 11
test product 33
test product 20
test product 111
test product 333

Ben şans olmadan sort ve rsort denedim.

O yardımcı olabilir, benim amacım bu gibi görünüyor:

array(8) {
  [0]=>
  object(stdClass)#12 (49) {
    ["product_id"]=>
    string(3) "335"
    ["product_guid"]=>
    string(36) "F0161D03-33EF-6F40-C816-AEDB33640E36"
    ["account_id"]=>
    string(2) "28"
    ["category_id"]=>
    string(3) "189"
    ["brand_guid"]=>
    NULL
    ["product_title"]=>
    string(10) "Fadestativ"
    ["push_date"]=>
    string(19) "2011-01-18 13:02:11"
    ["product_price"]=>
    string(3) "560"
    ["product_price_before"]=>
    string(1) "0"
    ["on_stock"]=>
    string(1) "0"
    ["product_weight"]=>
    string(1) "0"
    ["product_int_number"]=>
    string(0) ""
    ["product_ext_number"]=>
    string(0) ""
    ["product_small_info"]=>
    string(0) ""
    ["product_big_info"]=>
    string(31) "3 benet fad stativ højde 19 cm"
    ["active"]=>
    string(1) "1"
    ["meta_title"]=>
    string(0) ""
    ["meta_keyword"]=>
    string(0) ""
    ["meta_description"]=>
    string(0) ""
    ["product_new"]=>
    string(1) "0"
    ["indicative_price"]=>
    string(1) "0"
    ["cost_price"]=>
    string(1) "0"
    ["id"]=>
    string(2) "28"
    ["domain"]=>
    string(26) "eventhuset.schemecloud.com"
    ["password"]=>
    string(32) "098f6bcd4621d373cade4e832627b4f6"
    ["resellerid"]=>
    string(1) "2"
    ["defualt_lang"]=>
    string(2) "dk"
    ["quota"]=>
    string(3) "100"
    ["account_type"]=>
    string(3) "cms"
    ["busniess_name"]=>
    string(0) ""
    ["busniess_street"]=>
    string(0) ""
    ["busniess_city"]=>
    string(0) ""
    ["busniess_zipcode"]=>
    string(0) ""
    ["busniess_contry"]=>
    string(0) ""
    ["busniess_phone"]=>
    string(0) ""
    ["busniess_contact_person"]=>
    string(0) ""
    ["busniess_contact_phone"]=>
    string(0) ""
    ["busniess_email"]=>
    string(0) ""
    ["busniess_cvr"]=>
    string(0) ""
    ["invoice_name"]=>
    string(0) ""
    ["invoice_street"]=>
    string(0) ""
    ["invoice_city"]=>
    string(0) ""
    ["invoice_zipcode"]=>
    string(0) ""
    ["invoice_contry"]=>
    string(0) ""
    ["invoice_contact_person"]=>
    string(0) ""
    ["invoice_cvr"]=>
    string(0) ""
    ["payment_expires"]=>
    string(19) "0000-00-00 00:00:00"
    ["next_order_number"]=>
    string(5) "10001"
    ["order_prefix"]=>
    string(0) ""
  }
  [1]=>
  object(stdClass)#14 (49) {
    ["product_id"]=>
    string(3) "306"
    ["product_guid"]=>
    string(36) "8119C253-84C7-73AC-4125-DF4B1728A203"
    ["account_id"]=>
    string(2) "28"
    ["category_id"]=>
    string(3) "189"
    ["brand_guid"]=>
    NULL
    ["product_title"]=>
    string(15) "Kartoffel skål"
    ["push_date"]=>
    string(19) "2011-01-17 13:40:08"
    ["product_price"]=>
    string(3) "680"
    ["product_price_before"]=>
    string(1) "0"
    ["on_stock"]=>
    string(1) "0"
    ["product_weight"]=>
    string(1) "0"
    ["product_int_number"]=>
    string(0) ""
    ["product_ext_number"]=>
    string(0) ""
    ["product_small_info"]=>
    string(0) ""
    ["product_big_info"]=>
    string(31) "Kartoffel skål i rustfri stål"
    ["active"]=>
    string(1) "1"
    ["meta_title"]=>
    string(0) ""
    ["meta_keyword"]=>
    string(0) ""
    ["meta_description"]=>
    string(0) ""
    ["product_new"]=>
    string(1) "0"
    ["indicative_price"]=>
    string(1) "0"
    ["cost_price"]=>
    string(1) "0"
    ["id"]=>
    string(2) "28"
    ["domain"]=>
    string(26) "eventhuset.schemecloud.com"
    ["password"]=>
    string(32) "098f6bcd4621d373cade4e832627b4f6"
    ["resellerid"]=>
    string(1) "2"
    ["defualt_lang"]=>
    string(2) "dk"
    ["quota"]=>
    string(3) "100"
    ["account_type"]=>
    string(3) "cms"
    ["busniess_name"]=>
    string(0) ""
    ["busniess_street"]=>
    string(0) ""
    ["busniess_city"]=>
    string(0) ""
    ["busniess_zipcode"]=>
    string(0) ""
    ["busniess_contry"]=>
    string(0) ""
    ["busniess_phone"]=>
    string(0) ""
    ["busniess_contact_person"]=>
    string(0) ""
    ["busniess_contact_phone"]=>
    string(0) ""
    ["busniess_email"]=>
    string(0) ""
    ["busniess_cvr"]=>
    string(0) ""
    ["invoice_name"]=>
    string(0) ""
    ["invoice_street"]=>
    string(0) ""
    ["invoice_city"]=>
    string(0) ""
    ["invoice_zipcode"]=>
    string(0) ""
    ["invoice_contry"]=>
    string(0) ""
    ["invoice_contact_person"]=>
    string(0) ""
    ["invoice_cvr"]=>
    string(0) ""
    ["payment_expires"]=>
    string(19) "0000-00-00 00:00:00"
    ["next_order_number"]=>
    string(5) "10001"
    ["order_prefix"]=>
    string(0) ""
  }

ve ben sonra sıralamak gerekir

array(8) {
  [0]=>
  object(stdClass)#12 (49) {
    ["product_title"]=>
    string(10) "Fadestativ"
}

0 Cevap