I have a $date
variable and I like to copy his value in $date1
.
The problem is when I modify $date1 value with date_add()
the value of $date is modified too.
How to modify only $date1
value?
<?php
$date=date_create("2013-03-15");
echo "date =>" . date_format($date,"Y-m-d");
echo " ******** ";
$date1=$date;
date_add($date1,date_interval_create_from_date_string("40 days"));
echo "date after modify date1 =>" . date_format($date,"Y-m-d");
?>