PHP code example of componenta / priority-list

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

    

componenta / priority-list example snippets


use Componenta\Stdlib\PriorityList;

$list = PriorityList::ofStrings()
    ->insert('low', 10)
    ->insert('high', 100);

$list->extract(); // "high"

$list->asc();  // lowest priority first
$list->desc(); // highest priority first