Write a PHP script to select first 5 words from the following string.
Sample String : 'The quick brown fox jumps over the lazy dog'
Pictorial Presentation:
<?php $my_string = 'The quick brown fox jumps over the lazy dog'; echo implode(' ', array_slice(explode(' ', $my_string), 0, 5))."\n"; ?>
Sample Output:
The quick brown fox jumps
total answers (1)
start bookmarking useful questions and collections and save it into your own study-lists, login now to start creating your own collections.
Sample Output:
need an explanation for this answer? contact us directly to get an explanation for this answer