phpSensei Posted July 30, 2007 Share Posted July 30, 2007 I am creating a simple function that gets a text that has the strlen (string length) longer than 300 chars, and cuts it down to 100 hundred then adds three "...", and I know what to do from there on.. What function cuts down a string at a single char number...? Quote Link to comment Share on other sites More sharing options...
hitman6003 Posted July 30, 2007 Share Posted July 30, 2007 http://www.php.net/substr Quote Link to comment Share on other sites More sharing options...
Asperon Posted July 30, 2007 Share Posted July 30, 2007 well the str_split() function can do the following <?php $str = "Hello Friend"; $arr1 = str_split($str); $arr2 = str_split($str, 3); print_r($arr1); // every index is a letter $arr1(0) is 'H' $arr1(1) is 'e' etc print_r($arr2); //takes every 3 letters $arr1(0) is 'Hel' $arr1(1) is 'lo ' etc ?> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.