Uppercase each first letter of words with preg_replace

后端 未结 2 825
清酒与你
清酒与你 2021-01-22 15:16

So I have some sentences I am inserting into a database with some auto-correction processes. The following sentence:

$sentence = \"Is this dog your\'s because it         


        
2条回答
  •  醉梦人生
    2021-01-22 15:39

    You are probably looking for ucwords instead (Demo):

    $sentence = "Is this dog your's because it can't be mine";
    
    echo ucwords($sentence); # Prints "Is This Dog Your's Because It Can't Be Mine"
    

提交回复
热议问题