Changing the capitalization of stings

Making the string all capital letters:

You can simulate the CAPSLOCK key using thestrtoupper() PHP function.

Making the string all lower case letters:

You can also force all letters in a string to be lower case. This is done with the strtolower() PHP function.

Capitalizing each word:

You can choose to only capitalize the first letter of every word. This works great when working with a list of names or cities. This is done with theucwords() PHP function.

Code :

<?php

// using strtoupper() we can easily get all characters in capital.

echo strtoupper(“This is Premal Katigar”);

?>
<br>
<?php

// using strtoupper() we can easily get all characters in capital.

echo strtolower(“This is Premal Katigar”);

// using ucwords() we can easily get all words with first character capitalized

?>
<br>
<?php
print((ucwords(‘premal,katigar’)));
?>

capitalize all words

Output Of above code :

capitalized character output

 

Know More about php

Mail me your topic or problems

premalkatigar2@gmail.com

Contact : +91-84604-57306

Advertisements