Hello.
I read the documentation, I tried to write a regular list on its material. Something is not really moved forward (or rather not as desired). In general, I decided to write a regular book that will draw the text between the brackets. Here's what happened:
preg_match_all('/\[([A-Za-z0-9]+)\]/', '[text0[text01][text02[text023[text0234]]]][text1]', $m); // выводится: Array ( [0] => text01 [1] => text0234 [2] => text1 ) I try to pull out all the values that lie between all the brackets. And write the result like this:
Array( 0 => Array( 'text0' => Array( 0 => 'text01' ), Array( 'text02' => Array( 'text023' => Array( 0 => 'text0234' ) ) ) ), 1 => Array( 0 => 'text1' ) ); Those. each level of parentheses will be responsible for the new level of the array.