3v4l.org

run code in 300+ PHP versions simultaneously
<?php declare(strict_types = 1); /** * @template TReturn * @param Closure(): TReturn $closure * @param 'static'|class-string|object $newScope * @return Closure(): TReturn */ function bind(Closure $closure, string|object $newScope = 'static'): Closure { /** @var ?Closure(): TReturn */ $boundClosure = $closure->bindTo(null, $newScope); assert($boundClosure !== null, 'Failed to bind closure.'); return $boundClosure; } final class Vault { public function __construct( private readonly string $secret, ) { } } $vault = new Vault('https://disk.yandex.ru/i/OG-9MXrogsS05g'); $secretAccessor = bind(static fn (): string => $vault->secret, $vault); $secret = $secretAccessor(); var_dump($secret);
Output for git.master_jit, git.master
string(39) "https://disk.yandex.ru/i/OG-9MXrogsS05g"

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:
52.36 ms | 405 KiB | 5 Q