Hi,
I am executing system call function in the loop ..But i am getting last statement of the result only.
for example:
for($i=0;$i<count($splitfile);$i++){
$hinfo=system("cat /home/flatmonk/www/Data/Lists/".
escapeshellarg($splitfile[$i]),$retvalue);
if($hinfo)
echo $retvalue.'<br>';
}
I am getting last result only......
Thanks,
Murthy
problem with system call function
Moderator: General Moderators
I am not sure what you are saying.
Are you saying that you only get the last line from the last file in the $splitfile array or are you saying that you only get the last line from each file in the $splitfile array.
if the latter, then this is how the [php_man]system[/php_man] function works.
If you want to read the complete contents of a file, then use [php_man]file_get_contents[/php_man] or [php_man]fread[/php_man] and its cousins.
Hope this helps.
Are you saying that you only get the last line from the last file in the $splitfile array or are you saying that you only get the last line from each file in the $splitfile array.
if the latter, then this is how the [php_man]system[/php_man] function works.
If you want to read the complete contents of a file, then use [php_man]file_get_contents[/php_man] or [php_man]fread[/php_man] and its cousins.
Hope this helps.
- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact: