<?php
$promos = [
'123' => ['id' => '123', 'weight' => 1],
'234' => ['id' => '234', 'weight' => 3],
'345' => ['id' => '345', 'weight' => 2],
];
$cr['promos'] = [
'123' => ['id' => '123', 'weight' => 1],
'234' => ['id' => '234', 'weight' => 3],
'345' => ['id' => '345', 'weight' => 2],
];
$promo_weights = array_column($promos, 'weight', 'id');
array_multisort($promo_weights, SORT_ASC, $cr['promos']);
var_dump($cr['promos']);
preferences:
34.77 ms | 402 KiB | 5 Q