PHP code example of carloswph / sorter

1. Go to this page and download the library: Download carloswph/sorter library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

carloswph / sorter example snippets




$matos = \Sorter\MatosGoulart::sort([2, 6, 78, 11, 23, 1, 4, 1902, 192]);

/*
Results in:

array(9) {
  [0]=>
  int(1)
  [1]=>
  int(2)
  [2]=>
  int(4)
  [3]=>
  int(6)
  [4]=>
  int(11)
  [5]=>
  int(23)
  [6]=>
  int(78)
  [7]=>
  int(192)
  [8]=>
  int(1902)
}

*/

use Sorter\Benchmark;

([2, 4, 1, 23, 32, 11, 45, 67, 5, 233455, 344 , 7, 24, 67, 1111111, 111, 34, 2344]);
$ro->get();

/*
RESULTS IN:

array(8) {
  ["quick"]=>
  string(14) "0.127814000000"
  ["bubble"]=>
  string(14) "0.033583000000"
  ["heap"]=>
  string(14) "0.035445000000"
  ["gnome"]=>
  string(14) "0.015428000000"
  ["shell"]=>
  string(14) "0.012064000000"
  ["comb"]=>
  string(14) "0.000609000000"
  ["insertion"]=>
  string(14) "0.015089000000"
  ["matos_goulart"]=>
  string(14) "0.011882000000"
}
*/