How to String Replace Capital Letters in PHP?
Hi Dev,
This tutorial will provide example of how to string replace capital letters in PHP. We will use capitalize in php with code examples. this example will help you PHP strtoupper() function. This tutorial will give you simple example of how to replace all uppercase letters with spacing using php. Here, Creating a basic example of change all letter to uppercase php.
Below programs illustrate the strtoupper() function in PHP. The strtoupper() is a widely used function of PHP. Below some examples are given. With the help of these examples, we can understand the working of this function practically
Example: 1
index.php
<?php
// original string
$str = "nicesnippets";
// string converted to upper case
$resStr = strtoupper($str);
print_r($resStr);
?>
Output:
NICESNIPPETS
Example: 2
index.php
<?php
$input_str = "hie! learn php post at nicesnippets.com";
$result_str = strtoupper($input_str);
echo "String after conversion: ". $result_str;
?>
Output:
String after conversion: HIE! LEARN PHP POST AT NICESNIPPETS.COM
I hope it could help you...
- How To Use Php Conditional Statement Example
- How to Check if String Contains Regex in PHP?
- PHP Array_column() Function Example
- PHP Generate List of Random Numbers Between 0 and 100 Example
- How to User Login with Facebook in PHP?
- How to Explode Every Character into Array Using PHP Example?
- PHP Form Validation Tutorial
- PHP Convert XML to JSON Example