-2
list($s1,$s2,$s3)=explode("-",$EndDate);

It is showing:-

Undefined offset: 2 in C:\xampp\htdocs\finishingbrands_new\include\checkReportDates.php on line 3

Alive to die - Anant
  • 70,531
  • 10
  • 51
  • 98
Ammy
  • 5
  • 4

2 Answers2

0

There are three parameters in the list($s1, $s2, $s3), but the $EndDate could be exploded into two array. So the first index of the exploded array will be assigned to $s1. Similarly, the second will be assigned to $s2, and the third will be assigned to $s2. As there is no index of 2, php certainly raise a notice: Undefined offset: 2.

Paul
  • 1,630
  • 1
  • 16
  • 23
0

You obviously have incorrect data in $EndDate.

The code runs without problems with 2016-06-03
https://3v4l.org/BIJai

But if we remove one part of the date we get the error you say.

2017-06 returns error.
https://3v4l.org/AmbKP

Andreas
  • 23,610
  • 6
  • 30
  • 62