0

I have two arrays, the first one has the priorities that will sort the other array based on its value here is an example :

The defined priority array is:

$priorities = [ 4 => 1, 3 => 2, 2 => 3, 1 => 4 ];

The keys in this array is the order of the value in the array, this means that for the first value 1 it's order number is 4 and so on,

The second array is values array as follow:

$values = [1,4];

I just need the value of the first order in the values array, so the expected output is :

[ 4 ]

another example and expected result:

$priorities = [ 4 => 2, 3 => 1, 2 => 3, 1 => 4 ];

$values = [2,1];

Expected output is: [ 2 ]

0 Answers0