I want to store a html text into database as splitted to individual characters. Since, the text is long and the process is frequence, performance is of particular importance. Thus, I need to find an efficient way to conudct this in PHP without overload of building multiple arrays.
Of course, the purpose is simple text with a few markup html tags, without nested nodes. It can be considered for BBCode or something like that. I just want to have this possibility to skip some tags in this split process.
Example:
$html='This <i>is</i> a <strong>test</test>';
This string should be stored in mysql database as
id character html_tag
1 T
2 h
3 i
4 s
5
6 i italic
7 s italic
8
9 a
10
11 t strong
12 e strong
13 s strong
14 t strong
15 !
How to capture the individual characters without corresponding html tags?
<strong>nested <em>tags</em> </strong>? But if performance & correctness is an issue, go withxmlreader.DIVs.mysql, as this process can even be done bymysqlfunctions, since the target is to be stored in database. It is just easier to do this in PHP, but no obligation.