php first character uppercase Examples

Rate this post

Today, We want to share with you php first character uppercase.In this post we will show you php uppercase first letter of each word, hear for php capitalize all letters we will give you demo and example for implement.In this post, we will learn about How To Capitalize The First Letter Of A String In JavaScript with an example.

How to Convert the First Letter of a String to Uppercase in PHP?

Related functions:

  • lcfirst() – converts the first character of a string to lowercase
  • ucwords() – converts the first character of each word in a string to uppercase
  • strtoupper() – converts a string to uppercase
  • strtolower() – converts a string to lowercase
Read Also:  php parse XML File SimpleXML

syntax of the ucfirst()

ucfirst(string)

PHP ucfirst() Function

Example 1: index.php

<!DOCTYPE html>
<html>
<body>

<?php
echo ucfirst("welcome to Pakainfo.com");
?> 
 
</body>
</html>

Results

Welcome to Pakainfo.com

php uppercase first letter of each word

PHP – Capitalise first character of each word expect certain words
Example 2:

echo str_replace(['Pakainfo', 'Infinity'], ['pAkainfo', 'iNfinity'], ucwords(strtolower($string)));

php capitalize all letters

Example 3: PHP strtoupper() Function

<!DOCTYPE html>
<html>
<body>

<?php
echo strtoupper("Tamil Rockers is a torrent website which facilitates the illegal distribution of copyrighted material, including television shows, movies, music and videos.");
?> 
 
</body>
</html>

Results

TAMIL ROCKERS IS A TORRENT WEBSITE WHICH FACILITATES THE ILLEGAL DISTRIBUTION OF COPYRIGHTED MATERIAL, INCLUDING TELEVISION SHOWS, MOVIES, MUSIC AND VIDEOS.

Free Live Chat for Any Issue
Download

I hope you get an idea about php get first letter of each word.
I would like to have feedback on my infinityknow.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.