note 76583 added to function.substr-replace

From: Date: Sat, 21 Jul 2007 05:26:09 +0000
Subject: note 76583 added to function.substr-replace
Groups: php.notes 
Request: Send a blank email to php-notes+get-128789@lists.php.net to get a copy of this message
I am using this to truncate strings being pulled from the MySQL database for a news column located on the left of a clients site. you can visit http://www.azbizfilings.com to see it in action. below is just the important part of the code that you should be able to determine what has been done. <?php function trunc($phrase) { $max_words = 10; $phrase_array = explode(' ',$phrase); if(count($phrase_array) > $max_words && $max_words > 0) $phrase = implode(' ',array_slice($phrase_array, 0, $max_words)).'...'; return $phrase; } echo '<p>'.trunc($row['content']).'</p> <p align="right"> <a href="'.$home.'news.php?view=news&sID='.$sID.'">more</a> &raquo; </p>'; ?> ---- Server IP: 64.71.164.2 Probable Submitter: 68.2.47.74 ---- Manual Page -- http://www.php.net/manual/en/function.substr-replace.php Edit -- https://master.php.net/note/edit/76583 Del: integrated -- https://master.php.net/note/delete/76583/integrated Del: useless -- https://master.php.net/note/delete/76583/useless Del: bad code -- https://master.php.net/note/delete/76583/bad+code Del: spam -- https://master.php.net/note/delete/76583/spam Del: non-english -- https://master.php.net/note/delete/76583/non-english Del: in docs -- https://master.php.net/note/delete/76583/in+docs Del: other reasons-- https://master.php.net/note/delete/76583 Reject -- https://master.php.net/note/reject/76583 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#128789) next »