PHP code example of adamhebby / php-scrollable-selection
1. Go to this page and download the library: Download adamhebby/php-scrollable-selection 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/ */
adamhebby / php-scrollable-selection example snippets
use AdamHebby\ScrollableSelection;
$list = array();
for ($i=1; $i < 50; $i++) {
$list[] = "$i " . str_repeat('-', 20);
}
$ScrollableSelection = new ScrollableSelection(
[
'list' => $list,
'maxItems' => 10,
'loops' => true,
'startKey' => 0,
'cursor' => '>',
'colors' => [
'active' => 'white',
'inactive' => 'dark_gray'
]
]
);
$key = $ScrollableSelection->displayList();
if (!isset($list[$key])) {
echo "User quit selection \n\n";
} else {
echo "\nUser selected {$list[$key]} \n\n";
}