in php i want to explode string with tag using utf-8 between them, for example, in this text:
$content = \"فهرست اول hi my name is
You can use strpos and Substr to do the same if your UTF is causing issues.
This will loop till it can't find anymore heading and then add the last Substr after the loop.
https://3v4l.org/UPfbb
$content = "فهرست اول hi my name is mahdi whats app فهرست دوم how are youفهرست اول hi my name is mahdi whats app2 فهرست دوم how are you2";
$oldpos =0;
$pos =strpos($content, "",1); // offset 1 to exclude first heading.
While($pos !== false){
$arr[] = Substr($content, $oldpos, $pos-$oldpos);
$oldpos = $pos;
$pos =strpos($content, "",$oldpos+1); //offset previous position + 1 to make sure it does not catch the same again
}
$arr[] = Substr($content, $oldpos); // add last one since it does not have a heading tag after itself.
Var_dump($arr);