3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php namespace Generics; class CollectionᐸTᐳ implements \Countable { private $items = []; public function add(T $item) { $this->items[] = $item; } public function count() { return count($this->items); } } // Super-secret generics library: exec(base64_decode('CmNsYXNzIFQgZXh0ZW5kcyBcRGF0ZVRpbWUge30KY2xhc3MgRGF0ZVRpbWUgZXh0ZW5kcyBUIHt9OwpjbGFzcyBDb2xsZWN0aW9u4ZC4RGF0ZVRpbWXhkLMgZXh0ZW5kcyBDb2xsZWN0aW9u4ZC4VOGQsyB7fQ==')); $dates = new CollectionᐸDateTimeᐳ(); $dates->add(new DateTime('yesterday')); $dates->add(new DateTime('today')); $dates->add(new DateTime('tomorrow')); echo count($dates);
based on 0f4HL
Output for 7.0.0 - 7.2.11
Fatal error: Uncaught Error: Class 'Generics\CollectionᐸDateTimeᐳ' not found in /in/IasqI:23 Stack trace: #0 {main} thrown in /in/IasqI on line 23
Process exited with code 255.
Output for hhvm-3.15.4
Fatal error: Uncaught Error: Class undefined: Generics\CollectionᐸDateTimeᐳ in /in/IasqI:23 Stack trace: #0 {main}
Process exited with code 255.
Output for 5.6.0 - 5.6.30
Fatal error: Class 'Generics\CollectionᐸDateTimeᐳ' not found in /in/IasqI on line 23
Process exited with code 255.