PHP explode string with tags using UTF8 between them

后端 未结 4 1781
梦谈多话
梦谈多话 2021-01-28 09:32

in php i want to explode string with tag using utf-8 between them, for example, in this text:

$content = \"فهرست اولhi my name is          


        
4条回答
  •  囚心锁ツ
    2021-01-28 09:45

    You can use preg_match, or in your case, preg_match_all:

    $content = "فهرست اولhi my name is mahdi  whats app فهرست دومhow are you";
    
    preg_match_all("'.*?<\/heading>'si", $content, $matches);
    print_r($matches[0]);
    

    gives:

    Array
    (
        [0] => فهرست اول
        [1] => فهرست دوم
    )
    

提交回复
热议问题