Source Code:
(back to article)
<?php $descriptorspec = [ 0 => ["pipe", "r"], // stdin is a pipe that the child will read from 1 => ["pipe", "w"], // stdout is a pipe that the child will write to 2 => ["pipe", "w"], // stderr is a pipe that the child will write to ]; $process = proc_open('echo "Hello World!"', $descriptorspec, $pipes); if (is_resource($process)) { while ($s = fgets($pipes[1])) { print $s; } proc_close($process); }
Result:
Report an issue