Voting

: max(zero, nine)?
(Example: nine)

The Note You're Voting On

williamprogphp at[pleaseNOTSPAM] yahoo d
11 years ago
In order to make some multidimensional quick sort implementation, take advantage of this stuff

<?php
function quickSortMultiDimensional($array, $chave) {
if(
count( $array ) < 2 ) {
return
$array;
}
$left = $right = array( );
reset( $array );
$pivot_key = key( $array );
$pivot = array_shift( $array );
foreach(
$array as $k => $v ) {
if(
$v[$chave] < $pivot[$chave] )
$left[$k][$chave] = $v[$chave];
else
$right[$k][$chave] = $v[$chave];
}
return
array_merge(
quickSortMultiDimensional($left, $chave),
array(
$pivot_key => $pivot),
quickSortMultiDimensional($right, $chave)
);
}
?>

I make it using the idea from pageconfig dot com

tks for viewing

<< Back to user notes page

To Top