i ahve a summary for example

hsssssssssssssssssssssssssssssssssssssssssssssssssssss
hsssssssssssssssssssssssssssssssssssssssssssssssssss
sbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb

i wante to break these summary and dispaly only first line.

hsssssssssssssssssssssssssssssssssssssssssssssssssssss

which function i have to use?
any body please help me

Recommended Answers

All 3 Replies

This assumes the sentence ends with a period. I can't remember if this function will take an array of delimiters or not.

$strings = split(".",$summary);
echo $strings[0];

This assumes the sentence ends with a period. I can't remember if this function will take an array of delimiters or not.

$strings = split(".",$summary);
echo $strings[0];

Don't think it will take an array of delimiters. But you could use:

$strings = preg_split("/.|;|:/",$summary); // delimiters . ; : 
echo $strings[0];

which will achieve the same as taking an array of delimiters. Will bbe slower though.


i tried explode function and it worked. but tahnks for your help

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.