What is the purpose of the str_replace() function in PHP?

  • To replace occurrences of a substring in a string
  • To split a string into an array
  • To concatenate multiple strings
  • To convert a string to lowercase
The str_replace() function in PHP is used to replace all occurrences of a substring in a string with a specified replacement. It takes the substring to be replaced, the replacement string, and the input string as parameters and returns the modified string. This function is useful for string manipulation and replacing specific content. Learn more: http://php.net/manual/en/function.str-replace.php
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *