I've two dates from_date and to_date. How to swap the two dates if the from_date is greater than the to_date. Here is the code I've tried. Thank You!
$from_date = $con->real_escape_string($_POST['from']);
$to_date = $con->real_escape_string($_POST['to']);
if(strtotime($from_date) > strtotime($to_date)) {
$temp_date = $to_date;
$from_date = $to_date;
$to_date = $temp_date;
}