Page 1 of 1
Return xx nuber of letters
Posted: Sun Sep 11, 2005 9:44 am
by ddragas
Hi all
How to return first 30 letters from text in variable?
$text = "It costs thousands of dollars a year to pay for this sites' bandwidth and maintenance. Without your continued support, sacred-texts would go offline or have to be scaled back. Your support is crucial; this site does not receive grants or institutional support";
Result should be "It costs thousands of dollars "
Posted: Sun Sep 11, 2005 9:47 am
by patrikG
substr.
Powerful stuff, that manual, isn't it?
edit: "Ar, Ar!", said the pirate. You're getting slow, feyd

Posted: Sun Sep 11, 2005 9:47 am
by feyd
substr()
nicely done snipe patrik!
Posted: Sun Sep 11, 2005 9:56 am
by ddragas
Thank you
I've misslooked it.
One more question.
When long text is retrived from db it does not have "return" separator (\n) and on page text is displayed all together.
How to separate it?
Posted: Sun Sep 11, 2005 10:06 am
by ddragas
To explain myself better
output of text from db sholud be
What engleski?
STVARALA�TVO IZME�U DVA RATA 1918-1939.
Stvarala�tvo Ivana Me�trovi�a dijeli se na dvije razine: kiparsku i idejnu. Idejna razina dijeli se na jo� dva dijela: narodno-proro�ku politi�ku i religiozno-metafizi�ku. Me�trovi�eva narodno-proro�ka epoha zavr�ila je u dr�avotvornosti, a religiozna je imala stalnu tendenciju uspona sve do
instead of
What engleski?STVARALA�TVO IZME�U DVA RATA 1918-1939. Stvarala�tvo Ivana Me�trovi�a dijeli se na dvije razine: kiparsku i idejnu. Idejna razina dijeli se na jo� dva dijela: narodno-proro�ku politi�ku i religiozno-metafizi�ku. Me�trovi�eva narodno-proro�ka epoha zavr�ila je u dr�avotvornosti, a religiozna je imala stalnu tendenciju uspona sve do
Posted: Sun Sep 11, 2005 10:08 am
by Lobster
New lines aren't rendered in (X)HTML. Pass it through
nl2br()
Posted: Sun Sep 11, 2005 10:13 am
by ddragas
Thank you all