Re: storing the passthru() output as an array
| From: | Michael P. Carel | Date: | Tue, 07 Oct 2003 02:18:56 +0000 |
| Subject: | Re: storing the passthru() output as an array | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-165262@lists.php.net to get a copy of this message | ||
Thanks it works.
> 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
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php