我如何获得多年的年份

时间:2017-06-28 02:55:19

标签: php

我如何获得年数之间的年份

$starting_year=2016;
$ending_year=2020;

for ($x = $starting_year; $x < $ending_year; $x++) {
    echo "$x <br />";
} 

当前输出

2016
2017
2018
2019

期望的输出

2017
2018
2019

1 个答案:

答案 0 :(得分:1)

试试这个 -

<?php
$starting_year=2016;
$ending_year=2020;

for ($x = $starting_year+1; $x < $ending_year; $x++) {
    echo "$x <br />";
} ?>