3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?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; }
based on hNhFm
Output for 7.0.0 - 7.2.0
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 5.4.2 - 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.
Output for 5.3.18 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/fdZtr on line 5
Process exited with code 255.