0
Here I can't find a solution to sort the two arrays in this order?
I have two arrays. arr_1 = [66/11,67/11,66/12] arr_2 = [66/13,67/12] The result must be in a way that if 66 is first pushed to array.Then we must check the whole array if it contains 66 if not found, we can move to next value,here it is 67. If not we must move to arr_2 and array push 66 from it and if here we have 66 we should array push this to the result. Result must be like result=[66/11,67/11,67/12,66/12,66/13] The code i have tried is this $arr_1 = array(66,67,66); $arr_2 =array(66,67); $count_1=count($arr_1); $count_2=count($arr_2); $res=[]; for($i=0;i<$count;$i++){ if(in_array($arr_1[0],$arr_1){ array_push($res,$arr_1[0])} } ;
1 Respuesta
0
Are the elements supposed to be result of the expression? Eg: 66/11 = 6.
Or are they supposed to be strings?
Like this?
https://code.sololearn.com/w9G4UQHe7Ix2/?ref=app