Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => General

implode() not working

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

implode() not working

Postby raphael75 » Tue Feb 11, 2014 7:07 am

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!
raphael75
New php-forum User
New php-forum User
 
Posts: 20
Joined: Fri Apr 06, 2012 9:54 pm

Re: implode() not working

Postby raphael75 » Tue Feb 11, 2014 7:18 am

Turned out there was a stray \r at the end of each element. After removing it the implode works.
raphael75
New php-forum User
New php-forum User
 
Posts: 20
Joined: Fri Apr 06, 2012 9:54 pm


Return to PHP coding => General

Who is online

Users browsing this forum: Google Feedfetcher and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.