in php i want to explode string with tag using utf-8 between them, for example, in this text:
$content = "<heading>فهرست اول</heading>hi my name is mahdi whats app <heading>فهرست دوم</heading>how are you";
in that i have to <heading></heading> tag with utf8 between them, i want to have simple array with them like with:
$arr[0] = "<heading>فهرست اول</heading>hi my name is mahdi whats app";
$arr[1] = "<heading>فهرست دوم</heading>how are you";
strings between <heading></heading> are different, how can i make this array? question is how can i explode text by <heading>ENY TEXT</heading>
preg_splitwith/(?=<heading>.*?<\/heading>)/as pattern should work...$arr = preg_split('/(?=<heading>.*?<\/heading>)/', $content)will split the string on the<heading>tag, no matter of its contents without removing it. This should work...heading