1. Go to this page and download the library: Download nickbeen/sequential-rank 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/ */
enum Colors: string {
case RED = 'red';
case BLUE = 'blue';
case YELLOW = 'yellow';
public function order(): int {
return match ($this) {
self::RED => 1,
self::BLUE => 2,
self::YELLOW => 3,
}
}
}
enum Buttons: string {
case FORWARD = 'forward';
case DOWN = 'down';
case BACK = 'back';
case UP = 'up';
case X = 'x';
case Y = 'y';
case A = 'a';
case B = 'b';
public function order(): int {
return match ($this) {
self::FORWARD => 10,
self::DOWN => 20,
self::BACK => 30,
self::UP => 40,
self::X => 50,
self::Y => 60,
self::A => 70,
self::B => 80
}
}
}
$seqRank = new SequentialRank($attacks);
$seqRank->orderBy(Buttons::class);
$result = $seqRank->get();
$result = [
'10-10-80', // forward, forward, b
'10-20-60', // forward, down, y
'10-30-50', // forward, back, x
'20-10-60', // down, forward, y
'30-50-20-60-70', // back, x, down, y ,a
'30-70-60', // back, a, y
'40-50', // up, x
'50-60-70', // x, y, a
];
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.