How can the performance of looping through code lines be improved when displaying PHP code with line numbers in a forum post?
When displaying PHP code with line numbers in a forum post, the performance of looping through code lines can be improved by using the `implode()` function to concatenate the lines into a single string before displaying them. This reduces the number of echo statements needed to output each line individually, which can be slow and inefficient.
$codeLines = array(
"Line 1",
"Line 2",
"Line 3",
// Add more lines as needed
);
$codeString = implode("\n", $codeLines);
echo "<pre>" . $codeString . "</pre>";