Working with DateTime in projects again have a problem with duplicating if use array_unique to array which have a elemts of object,(but probles only with DateTime), see code:
class simpleClass
{
public $dt;
function __construct($dt)
{
$this->dt = $dt;
}
}
$dateObj = new simpleClass(new DateTime);
$std = new stdClass;
$arr = [$dateObj, $dateObj, $std, $std, $std, $std];
var_dump(array_unique($arr, SORT_REGULAR));
Expected 1 element with dateObj But actually there 2