我有這樣的文字刪除第一個HTML標籤一個字符串
<?php
$example1 = '<b class="counter">1</b> This is a computer';
$example2 = '<b class="counter">5</b> i have a laptop';
$example3 = '<b class="counter">1</b> i need a smartphone';
$example4 = 'i need a car'; // does not have <b> tag
?>
我在找一個PHP函數刪除字符串的一部分,從<b>
開始</b>
,所以結果應該是這樣的:
$example1_result = 'This is a computer';
$example2_result = 'i have a laptop';
$example3_result = 'i need a smartphone';
$example4_result = 'i need a car';
use strip_tags($ example1); – Exprator