Skip to content

All topics  /  PHP

How to String Replace Case Insensitive in PHP?

PHP ·

Hi Dev,

Today, I will let you know example of how to string replace case insensitive in php?. you will learn case-insensitive str_ireplace in php. it's simple example of how can replace string in php?. step by step explain php string replace by using str_ireplace case sensitive function. Here, Creating a basic example of how to replace a word inside a string in php?.

There are example to check if string replace case insensitive in php. in this example, we will use to and str_ireplace() function to check if string replace case insensitive. so let's the following example with output.

Example 1:


index.php

<?php    
    // Input string
    $subjectVal="how are you";

  
    // using str_ireplace() function
    $res = str_ireplace("are", "is", $subjectVal);

  
    echo $res;
?>

Output:

how is you

I hope it could help you...