$pipe = array(exec("netstat -tu")); $x=0; while ($x <= count($pipe)) { echo $pipe[$x]; $x++; }