You are here: Re: system() returns the last line of output twice « PHP Programming Language « IT news, forums, messages
Re: system() returns the last line of output twice

Posted by David Haynes on 06/23/06 20:05

seven.reeds wrote:
> Hi,
>
> I am running php v 5.0.0 on a redhat box. I have a php script in a
> file called p_script_1. I have another small script in file
> p_script_2. p_script_1 calles p_script_2 through a system() call. THe
> last line of the output from p_script_2 is duplicated. As a test I ran
>
> php -E 'echo system ("ls ");'
>
> <you have to hit ^D after you hit newline>. Anyway, this simple "ls"
> is also duplicating the last line of output. Is this a bug or feature?
>
>
> Oh, just got access to a brand new, up to date RedHat box running php
> 5.1.4 and it is happening there too.
>
ls already emits to STDOUT.

So, you have the output from the 'ls' command and then 'echo' echoing
the last line.

try php -E 'system("ls");' to see the difference.

To see what is really happening, try this:
php -E 'echo -->.system("ls");'

-david-

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация