how we can sort and asort digit without using default function of php....?
1
Expert's answer
2013-03-15T09:09:29-0400
To perform this task, we canuse the following method: compare each element of the array, and the larger of the two compared move to the right side, thus sorting array in ascending order. Below is the code, which is based on this method. <?php $input= array(0.1,77,0.5,6.2,6,2,4); for($i=0;$i<count($input)-1;$i++) for($c=0;$c<count($input)-1;$c++){ if($input[$c]>$input[$c+1]){ $t=$input[$c]; $input[$c]=$input[$c+1]; $input[$c+1]=$t; } } print_r($input); ?>
The expert did excellent work as usual and was extremely helpful for me.
"Assignmentexpert.com" has experienced experts and professional in the market. Thanks.
Comments