3v4l.org

run code in 300+ PHP versions simultaneously
<?php function pipe(&$_) { return new class($_) { private $_; public function __construct(&$_) { $this->$_ = &$_; } public function __call(string $name, array $args) : self { $this->_ = $name(...$args); return $this; } }; } pipe($blah)->strtoupper('hello')->strrev($blah); echo $blah;
Output for 8.2.0 - 8.2.18, 8.3.0 - 8.3.7
Deprecated: Creation of dynamic property class@anonymous::$ is deprecated in /in/vee4L on line 8 Deprecated: strrev(): Passing null to parameter #1 ($string) of type string is deprecated in /in/vee4L on line 12
Output for 8.1.0 - 8.1.28
Deprecated: strrev(): Passing null to parameter #1 ($string) of type string is deprecated in /in/vee4L on line 12
Output for 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30
Output for 7.0.0 - 7.0.20
Fatal error: Uncaught Error: Cannot access empty property in /in/vee4L:8 Stack trace: #0 /in/vee4L(4): class@anonymous->__construct(NULL) #1 /in/vee4L(18): pipe(NULL) #2 {main} Next Error: Cannot access empty property in /in/vee4L:8 Stack trace: #0 /in/vee4L(4): class@anonymous->__construct(NULL) #1 /in/vee4L(18): pipe(NULL) #2 {main} thrown in /in/vee4L on line 8
Process exited with code 255.

preferences:
179.36 ms | 402 KiB | 219 Q