You have a string "OpenAI" and you want to replace "Open" with "Close". Which PHP function will you use?

  • str_replace("Open", "Close", $str)
  • str_replace("Close", "Open", $str)
  • str_concat("Open", "Close", $str)
  • str_split("Open", "Close", $str)
To replace a substring in a string, you should use the str_replace function in PHP. It replaces all occurrences of the specified substring with another string within the given string.
Add your answer
Loading...

Leave a comment

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