$valuesMaxLen) { $valuesMaxLen = $valLen; } } $maxLen = max(strlen($col), $valuesMaxLen); $sep = str_repeat("-", $maxLen + 2); $col = " " . str_pad($col, $maxLen, pad_type: STR_PAD_BOTH) . " "; $valuesStr = ""; foreach ($values as $value) { if ($padVal) { $value = " " . str_pad($value, $maxLen, pad_type: STR_PAD_LEFT); } else { $value = " " . $value; } $valuesStr .= $value . "\n"; } return "$col\n$sep\n$valuesStr($valsCnt rows)\n\n"; }