note 80138 added to function.str-word-count

From: Date: Mon, 31 Dec 2007 09:38:09 +0000
Subject: note 80138 added to function.str-word-count
Groups: php.notes 
Request: Send a blank email to php-notes+get-134598@lists.php.net to get a copy of this message
/* Break the long text into small text as per your requirement - (Breaking with words) parameters - 1) Original String 2) Show Number of words of the your string */ function snippet($string,$word_count=10) { $ArrayWords=str_word_count($string, 1); // Return the words in Array $ReturnString=""; for($i=0;$i<$word_count;$i++) // Concate the words as per word count =10 { if($ReturnString=="") $ReturnString=$ArrayWords[$i]; else $ReturnString=$ReturnString." ".$ArrayWords[$i]; } return $ReturnString=$ReturnString." ..."; // Add the string '...' at last and return } ---- Server IP: 203.199.124.111 Probable Submitter: 122.169.22.211 ---- Manual Page -- http://www.php.net/manual/en/function.str-word-count.php Edit -- https://master.php.net/note/edit/80138 Del: integrated -- https://master.php.net/note/delete/80138/integrated Del: useless -- https://master.php.net/note/delete/80138/useless Del: bad code -- https://master.php.net/note/delete/80138/bad+code Del: spam -- https://master.php.net/note/delete/80138/spam Del: non-english -- https://master.php.net/note/delete/80138/non-english Del: in docs -- https://master.php.net/note/delete/80138/in+docs Del: other reasons-- https://master.php.net/note/delete/80138 Reject -- https://master.php.net/note/reject/80138 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#134598) next »