PHP code example of tsoffereins / number-sorter

1. Go to this page and download the library: Download tsoffereins/number-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/ */

    

tsoffereins / number-sorter example snippets


$sorter = new \NumberSorter\NumberSorter();

$input = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];

$output = $sorter->sort($input);

var_dump($output); // [8, 5, 4, 9, 1, 7, 6, 10, 3, 2]

$sorter = new \NumberSorter\NumberSorter('nl');

$input = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];

$output = $sorter->sort($input);

var_dump($output); // [8, 3, 1, 9, 10, 2, 4, 5, 6, 7]