mysterbx Posted January 24, 2008 Share Posted January 24, 2008 Hello, I need some help with a code, i need a code, that would remove the first line and show others... Example: $text = "line1\nline2\nline3\nline4\n"; Output: line2 line3 line4 (line1 has to be removed with some code, maybe preg_replace... i dont know... thats why im asking ) Any help would be great Quote Link to comment https://forums.phpfreaks.com/topic/87644-remove-lines-from-variable/ Share on other sites More sharing options...
jorgep Posted January 24, 2008 Share Posted January 24, 2008 $text = "line1\nline2\nline3\nline4\n"; $lines = explode("\n",$text); unset($lines[0]); $final_text = implode("\n",$lines); Quote Link to comment https://forums.phpfreaks.com/topic/87644-remove-lines-from-variable/#findComment-448268 Share on other sites More sharing options...
mysterbx Posted January 24, 2008 Author Share Posted January 24, 2008 Works 100%! THANKS A LOT! Quote Link to comment https://forums.phpfreaks.com/topic/87644-remove-lines-from-variable/#findComment-448287 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.