lofaifa Posted March 21, 2012 Share Posted March 21, 2012 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 More sharing options...
onlyican Posted March 21, 2012 Share Posted March 21, 2012 you need double quotes for the \n "\n" or "\r" sometimes, depending how the data is stored in the DB and the DB Type / Table Type Link to comment https://forums.phpfreaks.com/topic/259428-get-the-first-line-from-a-text/#findComment-1329884 Share on other sites More sharing options...
lofaifa Posted March 21, 2012 Author Share Posted March 21, 2012 thank u .. Link to comment https://forums.phpfreaks.com/topic/259428-get-the-first-line-from-a-text/#findComment-1329890 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.