raphael75 Posted February 11, 2014 Share Posted February 11, 2014 I have an array like this: $myarray Array( [0] => user1@example.com [1] => user2@example.com [2] => user3@example.com) When I do: implode(',', $myarray); I get: ,user3@example.com The 1st 2 elements are missing. I have another array that looks exactly like the one above but it has 15 elements, and when I do the same exact implode() statement I get a comma-separated list with all 15 elements. Why is implode() missing the 1st 2 elements? Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/286110-implode-not-working-as-expected/ Share on other sites More sharing options...
mac_gyver Posted February 11, 2014 Share Posted February 11, 2014 there's something about your actual data or something about how you are displaying/using the data that is causing it to not appear when being viewed or used. if this is being output in a browser, what does the 'view source' of the output look like? Quote Link to comment https://forums.phpfreaks.com/topic/286110-implode-not-working-as-expected/#findComment-1468480 Share on other sites More sharing options...
Solution raphael75 Posted February 11, 2014 Author Solution Share Posted February 11, 2014 Turned out there was a stray \r at the end of each element. After removing it the implode works. Quote Link to comment https://forums.phpfreaks.com/topic/286110-implode-not-working-as-expected/#findComment-1468482 Share on other sites More sharing options...
ginerjm Posted February 11, 2014 Share Posted February 11, 2014 How about showing us the actual code you used, instead of just the function name you used? Quote Link to comment https://forums.phpfreaks.com/topic/286110-implode-not-working-as-expected/#findComment-1468483 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.