Jump to content

get the first line from a text


lofaifa

Recommended Posts

i have a text from the database and i want to echo just the first line , but i dont know the character = new line

 

i tried those (to know the character) :

 

if(strpos($question['q_text'],'\n')!==false){echo 'yes';}
elseif(strpos($question['q_text'],'\n')===false){echo 'no';} 

if(strpos($question['q_text'],'<br>')!==false){echo 'yes';}
elseif(strpos($question['q_text'],'<br>')===false){echo 'no';} 

if(strpos($question['q_text'],'<br/>')!==false){echo 'yes';}
elseif(strpos($question['q_text'],'<br/>')===false){echo 'no';} 

 

 

all of them are No !

 

 

Link to comment
https://forums.phpfreaks.com/topic/259428-get-the-first-line-from-a-text/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.