I have a value, a DateTime that I clone and without touching it in a foreach I display it again. But without any clue the value has changed. I know it's from the:
if ($rtt->getPrttDateDebutPose()<$conge->getCngDateDebut() || $poseRTTService->getDateLastDay($rtt)>$conge->getCngDateFin()) {
Because I tested it, it's what can possibly change the value (even though I can't figure why either). But a clone ? Why would it change I don't do anything with it ?
Here's the complete code :
$end_rtt = clone end($RTT_pris);
var_dump($end_rtt); // -------------------------------------------------------------------------------------
// Algo that allows to separate in two arrays the conges w/ rtt and those w/o
foreach ($conges as $conge) {
$count = 0;
foreach ($RTT_pris as $rtt) {
if ($rtt->getPrttDateDebutPose()<$conge->getCngDateDebut() || $poseRTTService->getDateLastDay($rtt)>$conge->getCngDateFin()) {
$count++;
}
}
if ($count == count($RTT_pris) && !in_array($conge, $conges_final)) {
array_push($conges_final, $conge);
} else {
array_push($conges_w_rtt, $conge);
}
}
var_dump($end_rtt); // ---------------------------------------------------------------------------------------
And here's the output of the two var_dump($end_rtt)
:
See how the date pass from 11 to 20.
If anyone understands that, do please explain.