Zend - The PHP Company




Text

Add Code


Cutting long sized text with 'explode'  

Type: code fragment
Added by: u2love
Entered: 02/03/2000
Last modified: 08/12/1999
Rating: *** (9 votes)
Views: 9417
Cutting long size string


//-----------------source----------------//
<?php

$string
="Winamp is now freeware! Thanks to all who have previously registered, your support is really appreciated!";

function 
string_cut($string,$cut_size

  
$StringArray=explode(" ",$string); 
for(
$i=0;$i<$cut_size;$i++) 

$string_cut.=" "."$StringArray[$i]"

return 
"$string_cut"."..."

$string=""

echo 
string_cut($string,8); 
?> 

//-----------------result---------------------//


Winamp is now freeware! Thanks to all who...


Usage Example




Rate This Script





Search



This Category All Categories