My task is to split a date fetching from DB and find the date after 8 years.
My tries are here -
Variables:
$doo = $info['s_doo']; // 2013-05-01
$validity = $info['s_validity']; // 8
Try 1
$str="+".$validity." year";
echo date("d / m / Y",strtotime($str,$doo)); // Does not work
Try 2
$str="+".($validity*12)." month";
echo date("d / m / Y",strtotime($str,$doo)); // Does not work
Try 3
$str="+".($validity*52)." week";
echo date("d / m / Y",strtotime($str,$doo)); // Works but Wrong result
Finally
list($y, $m, $d) = split('-',$doo); // Line 107
$str = ($y+$validity)."-".$m."-".$d;
echo date("d / m / Y",strtotime($str)); // 01 / 05 / 2021
The output stands:
Deprecated: Function split() is deprecated in D:\****\accinfo.php on line 107
01 / 05 / 2021
If it's generating a correct output why the error message is being displayed? I don't know what the Deprecated message for.
I also tried using array instead of list and the split function like - split('-',$doo,10);
split('-',$info['s_doo'],10);
split('[-]',$doo);
etc...
I need a good way to do the task. Thanks you.