<?php$words_to_display = 3;$str = "word1, word2, word3, word4, word5"; $array = explode(', ', $str);print_r($array); $array = array_slice($array, 0, $words_to_display); $str = implode(', ', $array).' . . .';echo $str;?>
Standard input is empty
Array ( [0] => word1 [1] => word2 [2] => word3 [3] => word4 [4] => word5 ) word1, word2, word3 . . .
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!