- base64_decode: documentation ( source)
<?php
class CollectionᐸTᐳ implements \Countable
{
private $items = [];
public function add(T $item)
{
$this->items[] = $item;
}
public function count()
{
return count($this->items);
}
}
// Magic string to enable generics:
eval(base64_decode('Y2xhc3MgVCBleHRlbmRzIFxEYXRlVGltZSB7fSBjbGFzcyBEYXRl0KJpbWUgZXh0ZW5kcyBUIHt9IGNsYXNzIENvbGxlY3Rpb27hkLhEYXRlVGltZeGQsyBleHRlbmRzIENvbGxlY3Rpb27hkLhU4ZCzIHt9'));
$dates = new CollectionᐸDateTimeᐳ();
$dates->add(new DateТime('yesterday'));
$dates->add(new DateТime('today'));
$dates->add(new DateТime('tomorrow'));
$dates->add('tesst');
echo "There are " . count($dates) . " DateTimes in the Collection\n";