Sunday, March 19, 2017

php - using ucfirst for sticking words?

Let's say we want to uppercase the first letter in some strings like :

johndev
johnasp
johnphp
johnserver

and we use this for such purpose :

ucfirst(str_replace($name,ucfirst($name),$result['@attributes']['overflows']))

john is our $name variable. It works like this :

Johndev //** these also should be in uppercase, for example : JohnDev
Johnasp
Johnphp
Johnserver

DevJohn
AspJohn
PhpJohn
ServerJohn

How can I fix this?



via M. Safari

Advertisement