National_Instruments
200-500 · Question #195
The following code piece should print "PHP is cool", but unexpectedly, it just prints "cool". How would you correct it? echo str_replace('PHP is a pain.', 'a pain', 'cool');
The correct answer is B. str_replace('a pain', 'cool', 'PHP is a pain.'). See the full explanation below for the reasoning.
Question
The following code piece should print "PHP is cool", but unexpectedly, it just prints "cool". How would you correct it? echo str_replace('PHP is a pain.', 'a pain', 'cool');
Options
- Astr_replace('PHP is a pain.', 'cool', 'a pain');
- Bstr_replace('a pain', 'cool', 'PHP is a pain.');
- Cstr_replace('cool', 'a pain', 'PHP is a pain.');
How the community answered
(43 responses)- A16% (7)
- B77% (33)
- C7% (3)
Community Discussion
No community discussion yet for this question.