Converting the character case in PHP
Sometime we need to convert case of the word o variable we got in PHP. PHP have a built in function for converting the case of the word, Which can be use as below code. Some example are, we save all user name in database and after calling from database, we don't know what will be the output of name in the sense of character case, as user can enter his name all in capital, all in small or can insert into first character capitcal. So we will manipulate these as follow: First we convert in to lower case, suppose we are getting variable i.e. $username, so we do $username = strtolower($username); Then we convert it to according to our need as follow: If want only first character capital: $username = ucfirst( $username ); If want only first character capital: $username = strtoupper ( $username ); We can also do it by one line as : $username = ucfirst ( strtolower($username) ); $username = strtoupper ( strtolower($username) ); ############ Code ###