3v4l.org

run code in 300+ PHP versions simultaneously
<?php class User{ public $id; function __construct($id) { $this->id = $id; } } class UserStorage extends SPLObjectStorage{ public function getHash($obj){ return strval($obj->id); } } $us = new UserStorage(); $user1 = new User(1); $user2 = new User(2); $us->attach($user1); $us->attach($user2); $me = new User(2); // the following would normally fail since they are two separate objects // but it works now with our extended getHash() var_dump($us->contains($me));
Output for git.master, git.master_jit, rfc.property-hooks
Deprecated: Return type of UserStorage::getHash($obj) should either be compatible with SplObjectStorage::getHash(object $object): string, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/V59vj on line 14 bool(true)

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
45.23 ms | 402 KiB | 8 Q