Jump to content

exec foreach


zizzu

Recommended Posts

Hello i am trying to execute a linux program for every line of a textarea

 

        $text = $_POST['links'];
       
        $text = htmlspecialchars($_POST['links']);
        $text = nl2br($text);
       
        foreach(explode("\n",$text) as $row)
        {
                $result = NULL;
                $command = 'the command';
                exec($command,&$result);
                echo $result[0]."<br>";
        }

 

but this always print the result for last line of text area :(

for example if there are 3 lines it print 2 blanks and 1 result...

whats wrong??

Link to comment
https://forums.phpfreaks.com/topic/231277-exec-foreach/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.