PHPにテキスト文字列があります:
<strong> MOST </strong> of you may have a habit of wearing socks while sleeping.
<strong> Wear socks while sleeping to prevent cracking feet</strong>
<strong> Socks helps to relieve sweaty feet</strong>
ご覧のとおり、最初の強力なタグは
<strong> MOST </strong>
最初の強力なタグを削除し、その中の単語を ucwords (最初の文字を大文字) にします。このような結果
Most of you may have a habit of wearing socks while sleeping.
<strong> Wear socks while sleeping to prevent cracking feet</strong>
<strong> Socks helps to relieve sweaty feet</strong>
爆発機能を試してみましたが、私が望むものとは思えません。これが私のコードです
<?php
$text = "<strong>MOST</strong> of you may have a habit of wearing socks while sleeping. <strong> Wear socks while sleeping to prevent cracking feet</strong>. <strong> Socks helps to relieve sweaty feet</strong>";
$context = explode('</strong>',$text);
$context = ucwords(str_replace('<strong>','',strtolower($context[0]))).$context[1];
echo $context;
?>
私のコードのみの結果
Most of you may have a habit of wearing socks while sleeping. <strong> Wear socks while sleeping to prevent cracking feet