I would like to sort the array so that if a given value ($first_in_array) = 'brand'
value, the array would become the first it the queue. In the given example an array with index[1]
should appear like at index[0]
.
$first_in_array = 'PickMeFirst';
$data = Array(
0 => array(
'articleId' => 5478,
'articleName' => 'Demo artcle name 1',
'brand' => 'Unbranded',
),
1 => array(
'articleId' => 8785,
'articleName' => 'Demo artcle name 2',
'brand' => 'PickMeFirst',
),
2 => array(
'articleId' => 1258,
'articleName' => 'Demo artcle name 3',
'brand' => 'None',
),
);