// takes an array and desired key value and returns an array
// searches through an array for a given key, if found the key that row is made the first row and the other rows are inserted accordingly.
// the facility of this function is to get the value with a specific key of an array as the first value.
/////////////////////////////// function starts //////////////////////////////
function dksort($array, $case){
if(array_key_exists($case,$array)){
$a[$case] = $array[$case];
foreach($array as $key=>$val){
if($case==$key){
}else{
$a[$key] = $array[$key];
}
}
}
return $a;
}
$d = array(
'22'=>'jdfhgjfd',
'33'=>'jdfhgjfd',
'11'=>'jrtyrjfd',
'55'=>'jrtydairjfd',
'77'=>'jopo',
'99'=>'jrtasajfd',
'44'=>'jopasdwo',
'88'=>'hdgatyuyuiuy'
);
$c = dksort($d, '55');
print_r($c);
////////////////////////// function ends ////////////////////////////////////////