Not obvious.
Easiest solution : strip html tags and send plain text.
Html solution : parse your text in tags and text, then recreate correct pieces of limited length to be send.
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hey guys can anyone help me to get ride of unclosed tags in string? my input have +20000 length of strings, the service i use (telegram) limited to 4096 bytes, So i used str_split($input, 4000), The problem is my strings contains html tag i mean:
<b>My headline </b>
dolor sit amet, consec
quis nostrud exer
xcepteur sint
<b>My Second headline</b>
w dfficia deserunt
in voluptate velit
xcepteur sint
<b>My third headline</b>
another 500 headlines with b tag
If my input have unclosed tags the telegram api complains about it.
So when i splited them, some of the become > ... </b> or b>.... </b> , ... </b>, <b>...<
How can i detect and delete unclosed html tag after str_split?
Please or to participate in this conversation.