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.
Loading...
Related Quiz
- Once a constant is set in PHP, it cannot be ______ or ______.
- In PHP, the namespace separator is represented by ________.
- In PHP, variable names can start with a number.
- An array that has named indexes instead of numeric is called a(n) ________ array.
- You are writing a PHP script and you need to execute a block of code at least once, and then continue executing it as long as a certain condition is true. How would you do this using a do...while loop?