Re: storing the passthru() output as an array
| From: | David Otton | Date: | Tue, 07 Oct 2003 01:57:55 +0000 |
| Subject: | Re: storing the passthru() output as an array | ||
| References: | 1 | Groups: | php.general php.general |
| Request: | Send a blank email to php-general+get-165261@lists.php.net to get a copy of this message | ||
On Tue, 7 Oct 2003 09:41:03 +0800, you wrote:
>Have another problem here I need to get the output of this syntax
>
>$ps = (passthru("ps -ef"));
>
>and store it in an array line by line,
Turn on output buffering, grab the output of your script, then turn it off.
(ob_start, ob_get_contents, ob_end_clean)
But that's a hack; you're better off using shell_exec instead of passthru