Echo in for loop

前端 未结 2 537
陌清茗
陌清茗 2021-01-29 15:10

This is my code:




                        
    
提交评论

  • 2021-01-29 15:52

    After your edit, it looks like this is your main problem:

    $date = 2015-02-30;
    

    This is not what you think it is. It should be quoted like this:

    $date = '2015-02-30';
    

    Otherwise, $date is a not a string, it's a math expression that evaluates to (int) 1983, so substr($date, 8, 2); will evaluate to false, not 30, and then obviously your option won't be selected.

    0 讨论(0)
  • 提交回复
    热议问题