3v4l.org

run code in 300+ PHP versions simultaneously
<?php declare(strict_types=1); $i = 1; $s = ''; $_type_enforcer = new class($i, $s) { public function __construct( public int &$i, public string &$s ) {} }; try { $i = ''; } catch (\Throwable $e) { echo $e->getMessage(), PHP_EOL; } try { $s = 1; } catch (\Throwable $e) { echo $e->getMessage(), PHP_EOL; } unset($_type_enforcer); try { $i = ''; } catch (\Throwable $e) { echo $e->getMessage(), PHP_EOL; } try { $s = 1; } catch (\Throwable $e) { echo $e->getMessage(), PHP_EOL; }
Output for git.master, git.master_jit, rfc.property-hooks
Cannot assign string to reference held by property class@anonymous::$i of type int Cannot assign int to reference held by property class@anonymous::$s of type string

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