str_ireplace with replace ends my html tag.
$txt = '<p><strong>Add on </strong>[number],<strong> number nr </strong></p>';
$htmlValue = '<div class="resizing-input"><input type="text" value="1"><span style="display:none"></span></div>';
$text = str_ireplace('[number]', $htmlValue, $txt);//It needs to be case-insensitive so str_ireplace not str_replace.
echo'<pre>';print_r($text);echo'</pre>';die;
//return: <pre><p><strong>Add on </strong></p><div class="resizing-input"><input type="text" value="1"><span style="display:none"></span></div>,<strong> number nr </strong><p></p></pre>
//should return: <pre><p><strong>Add on </strong><div class="resizing-input"><input type="text" value="1"><span style="display:none"></span></div>,<strong> number nr </strong></p></pre>
Why it does like that?
I want to replace string between [] to html but it ends another html </p>
tag. Same thing happens with str_replace too.