Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- usort($dbDetails, function ($a, $b) use ($detail) {
- $adate = (strpos($a['detail_num'], $detail) !== false);
- $bdate = (strpos($b['detail_num'], $detail) !== false);
- if (!($adate ^ $bdate)) return strcmp($a, $b);
- return $adate ? -1 : 1;
- });
- if(!empty($dbDetails)){
- $result=array();
- foreach($dbDetails as $key=>$val){
- if((strcasecmp($detail,$val['detail_num'])==0)){
- unset($val['detail_analog']);
- $val['detail_parent']=1;
- array_unshift($result,$val);
- }
- else array_push($result,$val);
- unset($dbDetails[$key]);
- }
- unset($dbDetails);
- $dbDetails =$result;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement