|
1234567891011121314151617181920212223242526272829303132333435 |
- <?php
-
- namespace common\helpers;
-
- class Dropdown
- {
- public static function noYesChoices(): array
- {
- return [
- 0 => 'Non',
- 1 => 'Oui'
- ];
- }
-
- public static function numberChoices(
- int $start,
- int $end,
- bool $addNullValue = true,
- string $appendToValues = '',
- int $increment = 1
- ): array
- {
- $choicesArray = [];
-
- if($addNullValue) {
- $choicesArray[null] = '--';
- }
-
- for($i = $start; $i <= $end; $i += $increment) {
- $choicesArray[$i] = $i.$appendToValues;
- }
-
- return $choicesArray;
- }
- }
|