At 23:29 07.11.2002, conbud said:
--------------------[snip]--------------------
>Say I have a sentence that contains 8 words, how do I get PHP to list just 4
>of those 8 words ?
--------------------[snip]-------------------- 

Let's assume your words are delimited by one or more blanks, so you could:

        $arwords = split(' ',$sentence);        // make an array
        $arwords = array_slice($arwords, 0, 4); // return the first 4 entries
        echo join(' ', $arwords);               // and show them


-- 
   >O     Ernest E. Vogelsinger
   (\)    ICQ #13394035
    ^     http://www.vogelsinger.at/



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to