3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $descSpec = array( array('pipe','r'), // stdin array('pipe','w'), // stdout array('pipe','w') // stderr ); $proc = proc_open('bash', $descSpec, $pipes,'/tmp',array()); if(!is_resource($proc)){ throw new Exception("Could not open bash process"); } $stdin = &$pipes[0]; $stdout = &$pipes[1]; $stderr = &$pipes[2]; stream_set_blocking($stdout,0); stream_set_blocking($stderr,0); fwrite($stdin, "pwd\n"); fflush($stdin); $write = null; $except = null; $stdoutArr = array($stdout); $rv = stream_select($stdoutArr,$write,$except,1); $strIn = stream_get_line($stdout,4096); var_export(array('streamSelect_returnVal'=>$rv,'stdout_strRead'=>$strIn));
Output for 5.3.11 - 5.3.29, 5.4.1 - 5.6.28, 7.0.0 - 7.1.0
array ( 'streamSelect_returnVal' => 1, 'stdout_strRead' => false, )
Output for 5.0.3 - 5.3.10, 5.4.0, hhvm-3.10.0 - 3.12.0
array ( 'streamSelect_returnVal' => 1, 'stdout_strRead' => '', )
Output for 5.0.0 - 5.0.2
Warning: stream_get_line() expects exactly 3 parameters, 2 given in /in/jZs9N on line 26 array ( 'streamSelect_returnVal' => 1, 'stdout_strRead' => false, )
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_NEW in /in/jZs9N on line 10
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1
Parse error: parse error, unexpected T_NEW in /in/jZs9N on line 10
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/jZs9N on line 10
Process exited with code 255.