briant Posted May 16, 2009 Share Posted May 16, 2009 Hello, I have a field that contains values that I want to explode into an array but the values are on new lines. How would I explode it? I think \n is a return but that doesn't work. explode("\n", $field); Thanks in advance. Quote Link to comment Share on other sites More sharing options...
The Little Guy Posted May 16, 2009 Share Posted May 16, 2009 Something like one of these should work: $arr = explode("\n", $field); print_r($arr); $arr = explode("\r", $field); print_r($arr); Quote Link to comment Share on other sites More sharing options...
briant Posted May 16, 2009 Author Share Posted May 16, 2009 Beautiful, \r worked. I should have guessed \r is for return. Thanks Little Guy. Quote Link to comment Share on other sites More sharing options...
Daniel0 Posted May 16, 2009 Share Posted May 16, 2009 Only Windows uses \r for in line breaks. It uses \r\n whereas Unix based systems use \n. Quote Link to comment 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.