3v4l.org

run code in 300+ PHP versions simultaneously
<?php /** * Fluent interface marker */ interface FluentInterface { } interface Around{} //use Go\Aop\Intercept\MethodInvocation; class FluentInterfaceAspect implements Aspect { /** * Fluent interface advice * * @Around("within(FluentInterface+) && execution(public **->set*(*))") * * @param MethodInvocation $invocation * @return mixed|null|object */ protected function aroundMethodExecution(MethodInvocation $invocation) { $result = $invocation->proceed(); return $result!==null ? $result : $invocation->getThis(); } } class User implements FluentInterface { protected $name; protected $surname; protected $password; public function setName($name) { $this->name = $name; } public function setSurname($surname) { $this->surname = $surname; } public function setPassword($password) { if (!$password) { throw new InvalidArgumentException("Password shouldn't be empty"); } $this->password = $password; } } $user = new User; $user->setName('John')->setSurname('Doe')->setPassword('root');
Output for git.master, git.master_jit, rfc.property-hooks
Fatal error: Uncaught Error: Interface "Aspect" not found in /in/iauth:14 Stack trace: #0 {main} thrown in /in/iauth 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:
46.96 ms | 401 KiB | 8 Q