How to capitalize the first letter of each word in a string with PHP

1 Answer

0 votes
$s = "PHP is a general-purpose scripting language for web development";
 
$s = ucwords($s);
 
echo $s;
 
 
 
 
 
/*
run:
 
PHP Is A General-purpose Scripting Language For Web Development
 
*/

 



answered Jan 26, 2017 by avibootz
edited Jun 6, 2023 by avibootz
...