I am writing some PHP code to create PDFs using the FPDF library. And I basically use the same 4 lines of code to print every line of the document. I was wondering which is more efficient, repeating these 4 lines over and over, or would making it into a function be better? I'm curious because it feels like a function would have a larger overhead becuse the function would only be 4 lines long.
The code I am questioning looks like this:
$pdf->checkIfPageBreakNeeded($lineheight * 2, true); $text = ' label'; $pdf->MultiCell(0, $lineheight, $text, 1, 'L', 1); $text = $valueFromForm; $pdf->MultiCell(0, $lineheight, $text, 1, 'L'); $pdf->Ln();