Download the PHP package varaey/strategy without Composer
On this page you can find all versions of the php package varaey/strategy. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Please rate this library. Is it a good library?
Informations about the package strategy
Sorter lib.
This is a sorter library. This library use strategy pattern for sorting string or number array.
Installation
Next step is:
Usage
<?php
$array_char = ['f', 'a', 'b', 'd', 'c'];
$array_number = [8, 3, 4, 7, 1, 2, 5, 9, 6];
$sort = new Sorter(new StrategyFirstToLast());
echo 'Start sorting (From First to Last)' . \PHP_EOL;
\print_r($sort->sort($array_char));
\print_r($sort->sort($array_number));
echo \PHP_EOL;
echo 'Start sorting (From Last to First)' . \PHP_EOL;
$sort->setStrategy(new StrategyLastToFirst());
\print_r($sort->sort($array_char));
\print_r($sort->sort($array_number));
echo \PHP_EOL;
echo 'Start sorting (nulll object)' . \PHP_EOL;
$sort->setStrategy(new NullObjectSort());
\print_r($sort->sort($array_char));
\print_r($sort->sort($array_number));
License
This project is released under the terms of the BSD-3-Clause license.
Copyright (c) 2019, Svitozar Kuzemskyi
All versions of strategy with dependencies
PHP Build Version
Package Version
No informations.
The package varaey/strategy contains the following files
Loading the files please wait ....