Array
(
[0] => stdClass Object
(
[category_id] => 5
[distributor_id] => 999999
[name] => Attractions
[parent_category_id] => 0
[is_global_category] => 0
[category_logo] => qrcodes/categoryupload/img_1438954822_attractions.png
[is_active] => 1
[ticket_ids] =>
[position] => 0
)
[1] => stdClass Object
(
[category_id] => 5
[distributor_id] => 8885
[name] => Attractions
[parent_category_id] => 0
[is_global_category] => 0
[category_logo] => qrcodes/categoryupload/img_1438954822_attractions.png
[is_active] => 1
[ticket_ids] =>
[position] => 0
)
[2] => stdClass Object
(
[category_id] => 6
[distributor_id] => 999999
[name] => Walk & Bike
[parent_category_id] => 0
[is_global_category] => 0
[category_logo] => qrcodes/categoryupload/img_1438406863_walk-bike.png
[is_active] => 1
[ticket_ids] => ["13594"]
[position] => 0
)
)
i want to create new array from this array.Here two type of distributor id can come one is :
[distributor_id] => 999999 this is fixed
second is
[distributor_id] => $cod_id(8885) any person who is login
Now i want to create new array and want to give priority to [distributor_id] => $cod_id(8885) and want result look like this
Array
(
[0] => stdClass Object
(
[category_id] => 5
[distributor_id] => 8885
[name] => Attractions
[parent_category_id] => 0
[is_global_category] => 0
[category_logo] => qrcodes/categoryupload/img_1438954822_attractions.png
[is_active] => 1
[ticket_ids] =>
[position] => 0
)
[1] => stdClass Object
(
[category_id] => 6
[distributor_id] => 999999
[name] => Walk & Bike
[parent_category_id] => 0
[is_global_category] => 0
[category_logo] => qrcodes/categoryupload/img_1438406863_walk-bike.png
[is_active] => 1
[ticket_ids] => ["13594"]
[position] => 0
)
)
How to handle it using foreach and other solution
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire