3v4l.org

run code in 300+ PHP versions simultaneously
<?php final class Example1 { public string $name = 'asd' { set(string $value) { $this->name = $value; } } } final class Example2 { public string $name = 'asd' { set(string $value) { throw new \Exception('Cannot update value'); $this->name; } } } final class Example3 { // Cannot specify default value for virtual hooked property Example1::$name public string $name = 'asd' { set(string $value) { // $this->name = $value; } } } final class Example4 { // Cannot specify default value for virtual hooked property Example2::$name public string $name = 'asd' { set(string $value) { throw new \Exception('Cannot update value'); } } }
No results found

preferences:
141.81 ms | 996 KiB | 7 Q