3v4l.org

run code in 300+ PHP versions simultaneously
<?php $user = new \stdClass; $user->attributes = [ 'id' => 1, 'role' => 'admin', ]; $user->is = function($role) { if (in_array($role, ['amdin', 'user', 'guest'])) return $this->attributes['role'] === $role; else return false; }; var_dump($user->is('user')); var_dump($user->is('admin'));
Output for git.master, git.master_jit, rfc.property-hooks
Fatal error: Uncaught Error: Call to undefined method stdClass::is() in /in/vnEgE:14 Stack trace: #0 {main} thrown in /in/vnEgE on line 14
Process exited with code 255.

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