Interview Questions

What’s the output of the ucwords function in this example?

PHP Interview Questions and Answers


(Continued from previous question...)

What’s the output of the ucwords function in this example?

$formatted = ucwords("FYICENTER IS COLLECTION OF INTERVIEW QUESTIONS");
print $formatted;
What will be printed is FYICENTER IS COLLECTION OF INTERVIEW QUESTIONS.
ucwords() makes every first letter of every word capital, but it does not lower-case anything else. To avoid this, and get a properly formatted string, it’s worth using strtolower() first.


What’s the difference between htmlentities() and htmlspecialchars()?

htmlspecialchars only takes care of <, >, single quote ‘, double quote " and ampersand. htmlentities translates all occurrences of character sequences that have different meaning in HTML.

(Continued on next question...)

Other Interview Questions