word_wrap -- Break a text string into an array of lines
array word_wrap ( string string, float width[, array param])
This function takes a text string and breaks it into an array of strings based on the width parameter. The resultant array is broken on word boundries and paragraph bounderies (newlines). The resultant array can be used to paint the string, line-by-line on the page.
When a single word is too long to fit on a line, the word is placed on a line by itself, and the remainer of the string is processed as normal.
The param array is used to determine font and font size. If omitted, default values are used.
Breaks the string $data into an array of strings, none of which will be greater than 200 PDF units wide.
$strings = $pdf->word_wrap($data, 200);
The word_wrap()
function was added in version 1.14
Single words too long for a line are placed on a line by themselves.