3v4l.org

run code in 300+ PHP versions simultaneously
<?php $descriptorspec = array( 0 => array("pipe", "r"), // stdin is a pipe that the child will read from 1 => array("pipe", "w"), // stdout is a pipe that the child will write to 2 => array("file", "NULL", "a") // stderr is a file to write to ); $process = proc_open('ping -n 20 example.com', $descriptorspec, $pipes, getcwd(), $_ENV); if (is_resource($process)) { // $pipes now looks like this: // 0 => writeable handle connected to child stdin // 1 => readable handle connected to child stdout // Any error output will be appended to /tmp/error-output.txt fwrite($pipes[0], '<?php print_r($_ENV); ?>'); fclose($pipes[0]); echo stream_get_contents($pipes[1]); fclose($pipes[1]); // It is important that you close any pipes before calling // proc_close in order to avoid a deadlock $return_value = proc_close($process); echo "command returned $return_value\n"; } ?>
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 Error: Call to undefined function proc_open() in /in/NnJRg:9 Stack trace: #0 {main} thrown in /in/NnJRg on line 9
Process exited with code 255.
Output for 5.2.3 - 5.2.17, 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 7.4.33
Warning: proc_open(NULL): failed to open stream: Read-only file system in /in/NnJRg on line 9
Output for 5.5.0 - 5.5.38, 5.6.0 - 5.6.40, 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.34, 7.3.0 - 7.3.33, 7.4.0 - 7.4.32
Notice: Undefined variable: pipes in /in/NnJRg on line 9 Warning: proc_open() has been disabled for security reasons in /in/NnJRg on line 9
Output for 5.0.0 - 5.0.5, 5.1.0 - 5.1.6, 5.2.0 - 5.2.2
Warning: proc_open(NULL): failed to open stream: Permission denied in /in/NnJRg on line 9
Output for 4.3.0 - 4.3.11, 4.4.0 - 4.4.9
Warning: proc_open() expects exactly 3 parameters, 5 given in /in/NnJRg on line 9

preferences:
334.25 ms | 402 KiB | 468 Q