Home > Back-end >  Convert Sentence case string
Convert Sentence case string

Time:07-08

i want ask how to Convert Sentence case string in PHP

i have variable string

$sring = "hello world,world,world heloo";

i want convert Sentence case per "," to

$string = "Hello World,World,World Heloo";

how to make this please help all experts

CodePudding user response:

Uppercase each word after a comma

<?php
$sring = "hello world,world,world heloo";
echo ucwords(strtolower($sring), '\',');

CodePudding user response:

you can use ucwords function

<?php
    echo ucwords("hello,world", ",");
 ?> 
  •  Tags:  
  • php
  • Related