Get Chunk/No of words from the string or paragraphs
This is similar to substr of the built-in php function.
// Fetch the chunk of string by number of words from the paragraph or string.
This is similar to substr of the built-in php function.
// Fetch the chunk of string by number of words from the paragraph or string.
function substr_words ($string, $num_words) { $string = explode (' ', $string); $string = array_slice ($string, 0, $num_words); return implode (' ', $string); }
No comments:
Post a Comment
Please post any queries and comments here.