3v4l.org

run code in 300+ PHP versions simultaneously
<?php class UserEntity{ protected $record = null; public function __construct(array $record){ $this->record = $record; } public function getEMail(){ return $this->record['email']; } } class UserRepository{ protected $pdo = null; public function __construct(?PDO $pdo){ $this->pdo = $pdo; } public function byId(int $id){ //faking. should probably be moved to a ::make method or something. return new UserEntity([ 'name' => 'John', 'email' => 'blah@blah.com', ]); } public function add(UserEntity $user){ //... } } $userRepository = new UserRepository(null); $user = $userRepository->byId(34); var_dump($user->getEMail());
Output for git.master, git.master_jit, rfc.property-hooks
string(13) "blah@blah.com"

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:
47.1 ms | 401 KiB | 8 Q