yii\helpers\BaseConsole::select PHP Метод

select() публичный статический Метод

Gives the user an option to choose from. Giving '?' as an input will show a list of options to choose from and their explanations.
public static select ( string $prompt, array $options = [] ) : string
$prompt string the prompt message
$options array Key-value array of options to choose from
Результат string An option character the user chose
    public static function select($prompt, $options = [])
    {
        top:
        static::stdout("{$prompt} [" . implode(',', array_keys($options)) . ',?]: ');
        $input = static::stdin();
        if ($input === '?') {
            foreach ($options as $key => $value) {
                static::output(" {$key} - {$value}");
            }
            static::output(' ? - Show help');
            goto top;
        } elseif (!array_key_exists($input, $options)) {
            goto top;
        }
        return $input;
    }