<?php
// required headers
header("Access-Control-Allow-Origin: *");
header("Content-Type: application/json; charset=UTF-8");
header("Access-Control-Allow-Methods: POST");
header("Access-Control-Max-Age: 3600");
header("Access-Control-Allow-Headers: Content-Type, Access-Control-Allow-Headers, Authorization, X-Requested-With");

date_default_timezone_set('Asia/Rangoon');
$data = json_decode(file_get_contents("php://input"));

$today = date("Y-m-d");
$epdate = $data->start_date;

$d1 = date_create($data->start_date);
$d2 = date_create($data->cexp);

if( $d2 > $d1){
    $diff= date_diff($d1,$d2)->format("%a");
}else{
    $diff= 0 ;
}
// echo date('Y-m-d', strtotime("+" . ($data->days) . " days", strtotime($epdate)));

$arr = array(
    "new_expire_date" => date('Y-m-d', strtotime("+" . ($data->days) . " days", strtotime($epdate))),
    "Refund_date" => (int) $diff
);

echo json_encode($arr);

?>