RUN
Code execution
array(‘pipe’, ‘r’), // stdin
1 => array(‘pipe’, ‘w’), // stdout
2 => array(‘pipe’, ‘w’) // stderr
);
$process = proc_open($code, $descriptors, $pipes);
// Send input to stdin
fwrite($pipes[0], $input);
fclose($pipes[0]);
// Get output and errors from stdout and stderr
$output = stream_get_contents($pipes[1]);
$error = stream_get_contents($pipes[2]);
fclose($pipes[1]);
fclose($pipes[2]);
// Close process
$status = proc_close($process);
// Display errors if there are any
if (!empty($error)) {
echo ‘
‘ . $error . ‘
‘;
}
}
?>
Output:
Growth chart: