开发者

Strip Tags short div

开发者 https://www.devze.com 2023-01-19 05:49 出处:网络
Hello I have a lot of div tags, but I want to delete the div tag of characters开发者_开发知识库 in that little div tag.Number of string <10

Hello I have a lot of div tags, but I want to delete the div tag of characters开发者_开发知识库 in that little div tag.Number of string <10 ex

$txt=<<<HTML
 <div class="abc"> 123ab</div>
<div id="abc"> 123ab</div>

 <div class="abc"> 123abcdfdfsdfsdfdsfsdfsdfdsf</div>
HTML;

And return only dig(include long string)

$txt=<<<HTML
    <div class="abc"> 123abcdfdfsdfsdfdsfsdfsdfdsf</div>
HTML;


preg_replace('#<div(?:[^>]*)>.{0,10}</div>#u','',$txt)

not tested

0

精彩评论

暂无评论...
验证码 换一张
取 消