boccio
May 24th, 2002, 03:36 AM
hi all,
how can I 'cut off' string in PHP?
for example:
I have a field in dbase smth TEXT , and fill it with some text... like "This is a text, blah, blah" (of couse real text is much larger).
now, how can I create a "preview" of that so when I display result of query it shows only first few words: This is a ..... .
what i figured out is this:
$strDisplay = $row[text];
$strParse = $strDisplay{0} . $strDisplay{1} . $strDisplay{2};
which is not an option.... I'd like, say, first 20 chars to be displayed...
but how can I do like in c++ : $strParse = $strDisplay.Left(20) to take first 20 chars from left.....
TIA,
boris
how can I 'cut off' string in PHP?
for example:
I have a field in dbase smth TEXT , and fill it with some text... like "This is a text, blah, blah" (of couse real text is much larger).
now, how can I create a "preview" of that so when I display result of query it shows only first few words: This is a ..... .
what i figured out is this:
$strDisplay = $row[text];
$strParse = $strDisplay{0} . $strDisplay{1} . $strDisplay{2};
which is not an option.... I'd like, say, first 20 chars to be displayed...
but how can I do like in c++ : $strParse = $strDisplay.Left(20) to take first 20 chars from left.....
TIA,
boris