在PHP中删除字符串

时间:2016-05-06 08:20:55

标签: php string

我有一个字符串: -

$('a').click(function(){
  $pageNum = this.text();

  $.AJAX({
     PHPcode: <?PHP
                $mainStockTable = new EchoStock($mysqli, "mainstock", 20);
                $mainStockTable->ManualTransactionListTable(0);
            ?>
     success: function(response){
        $('table').html(response);
      }
});

我想首先使用php plz帮助删除

目标为: -

<p>my string data <br />
<p>We understand the challenges</p> <strong> that small to medium</strong> my string data my string data my string data </p>

1 个答案:

答案 0 :(得分:0)

猜猜你要从字符串中删除第一个p标签,你可以使用php trim

$string = '<p>my string data <br />
           <p>We understand the challenges</p> <strong> that small to medium</strong> my string data my string data my string data </p>';

$result_string = rtrim(ltrim(trim($string), '<p>'), '</p>');
echo $result_string;