-1

I am creating a code that contain shell script in PHP.

When I try to run using shell_execute I am not getting actual result.

Here's my code:

  for($i;$i<5;){
      $output = shell_exec('./url_integrity_check.sh ' ."'echo $test[$i]'" );
      $i++;
  }

$test is the array that contain the list of values.

When I run this code it takes only $test[0] means top value of array every time, but I want it to loop through all the values of array and execute the shell script each time it increments the value of $i

filype
  • 8,034
  • 10
  • 40
  • 66

1 Answers1

0

Try this

for($i=0;$i<5; $i++){

 $url = "./url_integrity_check.sh " . $test[$i];

 $output = shell_exec($url);

}
fortune
  • 3,361
  • 1
  • 20
  • 30