3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A{ public function sum($num1, $num2){ return $num1 + $num2; } } class B { public $property; public function __construct( A $object=null) { $property = $object; } } $test = new B(); echo $test->$property->sum(1,2); // output 3
Output for git.master, git.master_jit, rfc.property-hooks
Warning: Undefined variable $property in /in/kkqnZ on line 18 Warning: Undefined property: B::$ in /in/kkqnZ on line 18 Fatal error: Uncaught Error: Call to a member function sum() on null in /in/kkqnZ:18 Stack trace: #0 {main} thrown in /in/kkqnZ on line 18
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:
34.69 ms | 401 KiB | 8 Q