programming-examples/php/String/PHP script to select first 5 words from the following string..php

4 lines
140 B
PHP
Raw Normal View History

2019-11-15 12:59:38 +01:00
<?php
$my_string = 'The quick brown fox jumps over the lazy dog';
echo implode(' ', array_slice(explode(' ', $my_string), 0, 5))."\n";
?>