Basic PHP Programming Question:

Download Job Interview Questions and Answers PDF

I am writing an application in PHP that outputs a printable version of driving directions. It contains some long sentences, and I am a neat freak, and would like to make sure that no line exceeds 50 characters. How do I accomplish that with PHP?

PHP Interview Question
PHP Interview Question

Answer:

On large strings that need to be formatted according to some length specifications, use wordwrap() or chunk_split().

Download PHP Interview Questions And Answers PDF

Previous QuestionNext Question
For printing out strings, there are echo, print and printf. Explain the differences.What is the output of the ucwords function in this example?