Re: preview string with strlen PHP (help)

From: Date: Fri, 23 Mar 2007 23:48:11 +0000
Subject: Re: preview string with strlen PHP (help)
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-251230@lists.php.net to get a copy of this message
On Fri, March 23, 2007 10:18 am, Dwayne Heronimo wrote: > function previewString($showcatvar) { > > $minitxt = $showcatvar; > $len = strlen($minitxt); > > if ($len > 235) > { > $len = 235; > } > else > { > $len = $len; > } Take out this whole "else" block -- Assigning a variable to itself is just silly. > $newstring = substr($minitxt,0,$len); > > $previewtext = $newstring; > > $previewtext = $whowcatvar; You need to RETURN some value here, for the function to give back the "answer" so that your echo below has something to print out. http://php.net/return -- Some people have a "gift" link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So?

« previous php.general (#251230) next »