printf () - ваш друг здесь.
<?php
function printRows($rows){
$br = "+----------------------------------------------------------------+";
$he = "| rate | conn/s | req/s | replies/s avg | errors | net io (KB/s) |";
//Print out the header
print "$br\n$he\n$br\n";
//Iterate through the rows
foreach($rows as $row){
printf("|[%-5s] | [%-7s] | [%-5s] | [%-13s] | [%-6s] | [%-13s] |",
$row[0],$row[1],$row[2],$row[3],$row[4],$row[5]
);
}
//Print the end ascii-art
print "$br\n";
}
?>