Php remove dot from string

To remove a dot from a string in PHP, you can use the str_replace() function. This function replaces all occurrences of a specified value with another value in a given string.

Here is an example:

<?php
    $string = "Hello.World.";
    $removedDotString = str_replace(".", "", $string);
    echo $removedDotString;
?>
    

In this example, the variable $string contains the string “Hello.World.”. The str_replace() function is used to replace all occurrences of the dot (.) with an empty string, effectively removing the dots from the string. The resulting string is then stored in the $removedDotString variable.

The echo statement is used to display the modified string, which will output “HelloWorld” without the dots.

Leave a comment