Php 如何存储自定义标记

Php 如何存储自定义标记,php,parsing,Php,Parsing,我在我的应用程序中有自定义标记,如HTML的H1H2等 唯一的区别是H2应位于H1下,而H3应位于H2 例如: <H1> lorem ipsum sit dolor ... <H2> something else.... </H2> </H1> 标记数组包含标记对象 具有以下属性: $order // the order of the tag 1,2,3 etc $is_close_tag // Boolean, if its a close t

我在我的应用程序中有自定义标记,如HTML的
H1
H2

唯一的区别是
H2
应位于
H1
下,而
H3
应位于
H2

例如:

<H1> lorem ipsum sit dolor ... <H2> something else.... </H2> </H1>
标记数组包含标记对象 具有以下属性:

$order // the order of the tag 1,2,3 etc
$is_close_tag // Boolean, if its a close tag like </h2>
我可能应该使用

但我不知道如何检查树上的有效性。

现在我有了一个带标记的数组-arrray的格式是什么?现在我有了一个带标记的数组-arrray的格式是什么?
$order // the order of the tag 1,2,3 etc
$is_close_tag // Boolean, if its a close tag like </h2>
$last_tag = //
$oder_of_last_tag // lets say 2
$order_current_tag // if 3 valid else invalid