3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Controller { public function __construct(B $b) { $this->b = $b; } } class B { public function __construct(C $c) { $this->c = $c; } } class C { public function __construct(Guzzle $guzzle) { $this->guzzle = $guzzle; } } class Guzzle { } $getReflectedConstructorParams = function($className) { return (new \ReflectionClass($className))->getConstructor()->getParameters(); }; $className = 'Controller'; $graph = [$className]; // I hate recursion, there's much better ways while (!empty($getReflectedConstructorParams($className))) { $className = $getReflectedConstructorParams($className); $graph[] = $className; } var_dump($className);
Output for git.master, git.master_jit, rfc.property-hooks
Fatal error: Uncaught TypeError: ReflectionClass::__construct(): Argument #1 ($objectOrClass) must be of type object|string, array given in /in/Oa9Wk:9 Stack trace: #0 /in/Oa9Wk(9): ReflectionClass->__construct(Array) #1 /in/Oa9Wk(16): {closure}(Array) #2 {main} thrown in /in/Oa9Wk on line 9
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:
43.57 ms | 401 KiB | 8 Q