/*** PHP four basic sorting algorithm run time comparison*@authorsJesse (jesse152@163.com)*@date2016-08-11 07:12:14*/Bubble Sort Methodfunction Bubblesort($array){$temp =0;For($i =0;$i <Count($array)-1;$i + +){For($j =0;$j <Count($array) -1-$i;$j + +){If($array[$j] >$array[$j+1]){Arrange from small to large$temp =$array[$j];$array[$j] =$array[$j+1];$array[$j+1] =$temp; } } }}Select Sort methodfunction Selectsort($array){$temp =0;For($i =0;$i <Count($array) -1;$i + +){$minVal =$array[$i];Assuming $i is the minimum value$minValIndex =$i;For($j =$i+1;$j <Count($array);$j + +){If($minVal >$array[$j]){Arrange from small to large$minVal =$array[$j];Find Minimum value$minValIndex =$j; } }$temp =$array[$i];$array[$i] =$array[$minValIndex];$array[$minValIndex] =$temp; }}Insert Sort methodfunction Insertsort($array){Arrange from small to largeFirst default $array[0], already ordered, is an ordered tableFor($i =1;$i <Count($array);$i + +){$insertVal =$array[$i];$insertVal is the number that is ready to be inserted$insertIndex =$i-1;Subscript for the number of comparisons to be prepared in an ordered tableWhile($insertIndex >=0 &&$insertVal <$array[