V
V
Vitaly2020-01-08 16:40:23
PHP
Vitaly, 2020-01-08 16:40:23

How to correctly draw a rectangular background under the text?

How to correctly draw a rectangular background under the text. It's not a problem to draw through imagefilledrectangle, but what about when the text is wrapped.
I transfer it this way:

if($box[2] > $width - $margin*2){
        $text_new .= "\n".$word.$box[2];
    } else {
        $text_new .= " ".$word;
    }

Like in this picture:
5e15daa7eada4644501269.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton Shamanov, 2020-01-08
@SilenceOfWinter

a string into an array, the array is padded in length with spaces

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question