3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Identifier { protected $id; public function __construct($id) { $this->id = $id; } public function getValue() { return $this->id; } } class Example { protected $id; public function __construct(Identifier $id) { $this->id = $id; } public function sameValueAs($test) { return $test->id === $this->id; } } $identifier = new Identifier('1'); $example = new Example($identifier); var_dump($example);

preferences:
57.99 ms | 402 KiB | 5 Q