Beste,
Ik zit een beetje vast. Hoe kan ik hieronder een ID toevoegen? Ik wil dat er een gatal vanaf 0 komt te staan. En als het er 2 zijn, dat er staat 0 en dan een 1. Hieronder zie je wat ik bedoel:
Mijn huidige code:
Ouput:
Maar ik wil dat als output:
Ik zit een beetje vast. Hoe kan ik hieronder een ID toevoegen? Ik wil dat er een gatal vanaf 0 komt te staan. En als het er 2 zijn, dat er staat 0 en dan een 1. Hieronder zie je wat ik bedoel:
Mijn huidige code:
[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/foreach"]foreach[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$result[/COLOR] [COLOR= #007700]as[/COLOR] [COLOR= #0000BB]$value[/COLOR] [COLOR= #007700]=>[/COLOR] [COLOR= #0000BB]$key[/COLOR][COLOR= #007700]){[/COLOR]
[COLOR= #0000BB]$results[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/explode"]explode[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000] [/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$key[/COLOR][COLOR= #007700]);[/COLOR]
[URL="http://www.php.net/print"]print[/URL] [COLOR= #DD0000]"<cronjob><id></id><day>$results[0]</day><hour>$results[1]</hour><monthday>$results[2]</monthday><month>$results[3]</month><weekday>$results[4]</weekday><command>$results[5]</command></cronjob>"[/COLOR][COLOR= #007700];
}[/COLOR]
?> Ouput:
<cronjob><id></id><day>1</day><hour>2</hour><monthday>3</monthday><month>5</month><weekday>6</weekday><command>/home/allard/</command></cronjob>
<cronjob><id></id><day>4</day><hour>2</hour><monthday>1</monthday><month>5</month><weekday>6</weekday><command>/home/allard/</command></cronjob> Maar ik wil dat als output:
<cronjob><id>0</id><day>1</day><hour>2</hour><monthday>3</monthday><month>5</month><weekday>6</weekday><command>/home/allard/</command></cronjob>
<cronjob><id>1</id><day>4</day><hour>2</hour><monthday>1</monthday><month>5</month><weekday>6</weekday><command>/home/allard/</command></cronjob>
?