On Thu, 28 Aug 2003 09:17:48 +0000, Peter Taurins wrote:
substring your string starting at 0 and going for 20 and then echo the
result.
eg.
$newstring = substr($oldstring,0,20);
echo $newstring;
HTH
"Ricki Susic" <ri*************@webfabrikken.net> wrote in message
news:3f***********************@dread12.news.tele.d k... > Have you bothered to look at string functions in the documentation?
> http://www.php.net/manual/en/function.substr.php
Yes, I have looked in the manual but I'm sure that I'm not the first
person to get a bit confused trying to look up a certain solution in the php.net
manual. It is very hard to find the needed function when you don't know
what to look for!
You know what I mean?
Ricki
You can also do this in a single step:
echo substr($oldstring,0,20);
Two advantages of consolidating statements in order to eliminate temporary
variables are:
1). fewer lines of code and variables to analyze in the future when it is time
to make changes to the program, and
2). it is more efficient since the PHP runtime doesn't have to create a
variable and load it every time the program runs. The benefits are both
faster execution speed and more compact programs.