<?php
function dumpMappedRow($mappedRow)
{
var_dump([
'created' => $mappedRow['created']->format(DateTime::ISO8601),
'modified' => $mappedRow['modified']->format(DateTime::ISO8601)
]);
}
function objectDemo() {
$date = new DateTime();
$mappedRow['created'] = $date;
$mappedRow['modified'] = $date;
dumpMappedRow($mappedRow);
$mappedRow['modified']->setDate("2015", "11", "15");
dumpMappedRow($mappedRow);
if ($mappedRow['created']->getTimestamp() === $mappedRow['modified']->getTimestamp()) {
echo "\nCreated and Modified are set to the same value.";
}
}
function stringDemo() {
$date = "2015-09-24T21:17:43+0200";
$mappedRow['created'] = $date;
$mappedRow['modified'] = $date;
dumpMappedRow($mappedRow);
$mappedRow['modified'] = "2015-11-24T21:17:43+0200";
dumpMappedRow($mappedRow);
if ($mappedRow['created']->getTimestamp() === $mappedRow['modified']->getTimestamp()) {
echo "\nCreated and Modified are set to the same value.";
}
}