Re: storing the passthru() output as an array
| From: | Brad Pauly | Date: | Tue, 07 Oct 2003 01:56:22 +0000 |
| Subject: | Re: storing the passthru() output as an array | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-165259@lists.php.net to get a copy of this message | ||
On Mon, 2003-10-06 at 19:41, Michael P. Carel wrote:
> Hi again,
>
> 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, I specifically want to get the
> Columns of the PID for this command and store it in a selection box .
>
> Any Idea how, thanks in advance.
You can use output buffering to grab the output and explode to put the
lines in an array.
http://us4.php.net/manual/en/ref.outcontrol.php
ob_start();
passthru("ps -ef");
$ps = ob_get_contents();
ob_end_clean();
$lines = explode("\n",$ps);
- Brad