i have this text
<?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
?>
i'm looking for a php function to remove a part of the string, starting from <b>
to </b>
, so the results should be like :
$example1_result = 'This is a computer';
$example2_result = 'i have a laptop';
$example3_result = 'i need a smartphone';
$example4_result = 'i need a car';