3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { public $fileHandles = []; public $files = []; public function baz() { $offset = 15; $this->files[$offset] = tempnam(); if (false === $file || false === $this->fileHandles[$offset] = fopen($this->files[$offset], 'rb')) { throw new RuntimeException('A temporary file could not be opened to write the process output to, verify that your TEMP environment variable is writable'); } } } $foo = new Foo; $foo->baz(); function set($param) { if ($param > 10) { return $param; } return false; }
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
Fatal error: Uncaught ArgumentCountError: tempnam() expects exactly 2 arguments, 0 given in /in/fdZtr:12 Stack trace: #0 /in/fdZtr(12): tempnam() #1 /in/fdZtr(21): Foo->baz() #2 {main} thrown in /in/fdZtr on line 12
Process exited with code 255.
Output for 7.0.0 - 7.0.20, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.31, 7.4.0 - 7.4.33
Warning: tempnam() expects exactly 2 parameters, 0 given in /in/fdZtr on line 12 Notice: Undefined variable: file in /in/fdZtr on line 14 Warning: fopen(): Filename cannot be empty in /in/fdZtr on line 14 Fatal error: Uncaught RuntimeException: A temporary file could not be opened to write the process output to, verify that your TEMP environment variable is writable in /in/fdZtr:15 Stack trace: #0 /in/fdZtr(21): Foo->baz() #1 {main} thrown in /in/fdZtr on line 15
Process exited with code 255.
Output for 7.3.32 - 7.3.33
Warning: tempnam() expects exactly 2 parameters, 0 given in /in/fdZtr on line 12 Warning: fopen(): Filename cannot be empty in /in/fdZtr on line 14 Fatal error: Uncaught RuntimeException: A temporary file could not be opened to write the process output to, verify that your TEMP environment variable is writable in /in/fdZtr:15 Stack trace: #0 /in/fdZtr(21): Foo->baz() #1 {main} thrown in /in/fdZtr on line 15
Process exited with code 255.
Output for 5.4.2 - 5.4.45, 5.5.24 - 5.5.35, 5.6.7 - 5.6.28
Warning: tempnam() expects exactly 2 parameters, 0 given in /in/fdZtr on line 12 Notice: Undefined variable: file in /in/fdZtr on line 14 Warning: fopen(): Filename cannot be empty in /in/fdZtr on line 14 Fatal error: Uncaught exception 'RuntimeException' with message 'A temporary file could not be opened to write the process output to, verify that your TEMP environment variable is writable' in /in/fdZtr:15 Stack trace: #0 /in/fdZtr(21): Foo->baz() #1 {main} thrown in /in/fdZtr on line 15
Process exited with code 255.

preferences:
233.8 ms | 402 KiB | 256 Q