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 ! Quote 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 Quote 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 .. Quote 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
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.