I have following working code which read file contain and put into array but now i want to run command and place its output in array for example ls command
<?php
$path = "file.txt";
$file = fopen($path, 'r');
$data = fread($file, filesize($path));
fclose($file);
$lines = explode(" ",$data);
echo "<p><h1>$lines[0]</h1></p>";
?>
How do i read command output and place in array?