[COLOR= #0000BB]<?php
$array[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/explode"]explode[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"
"[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]mails[/COLOR][COLOR= #007700]]);[/COLOR]
[URL="http://www.php.net/foreach"]foreach[/URL] [COLOR= #007700]([/COLOR][COLOR= #0000BB]$array[/COLOR] [COLOR= #007700]as[/COLOR] [COLOR= #0000BB]$nu[/COLOR] [COLOR= #007700]=>[/COLOR] [COLOR= #0000BB]$maill[/COLOR][COLOR= #007700]) {[/COLOR]
[COLOR= #0000BB]$num[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$nu[/COLOR] [COLOR= #007700]+[/COLOR] [COLOR= #0000BB]1[/COLOR][COLOR= #007700];[/COLOR]
[COLOR= #0000BB]$niet[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/array"]array[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]" "[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]"
"[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]" "[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]"<br />"[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]""[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]" "[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]" "[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]" "[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]" "[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]"
"[/COLOR][COLOR= #007700]);[/COLOR]
[COLOR= #0000BB]$mail[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/str_replace"]str_replace[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$niet[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]""[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$maill[/COLOR][COLOR= #007700]);[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$num[/COLOR][COLOR= #007700].[/COLOR][COLOR= #DD0000]" is ""[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$mail[/COLOR][COLOR= #007700].[/COLOR][COLOR= #DD0000]""<br />"[/COLOR][COLOR= #007700];
}
}[/COLOR]
?> Dat is mijn code, ik wil die gebruiken voor een mail systeem. Ik plaats op elke regel een mailadres, en hij maakt er een array van. Werkt perfect! Alleen, achter elke mail van de POST komt een spatie te staan, behalve bij de laatste. Ik krijg deze niet weg. Iemand raad?
Voorbeeld:
"plof@boem.com
plof@boem.complof@boem.com
plof@boem.com
plof@boem.com
plof@boem.com"
geeft dit als output:
"1 is "plof@boem.com "
2 is "plof@boem.complof@boem.com "
3 is "plof@boem.com "
4 is "plof@boem.com "
5 is " "
6 is "plof@boem.com""
07:
Hij werkt