sphinx Posted November 18, 2011 Share Posted November 18, 2011 Hello there, I'm looking for a PHP method to duplicate a line, for example if I wanted to duplicate this line: mail($to,$subject,$message,$headers); How could I specify a value of how many are displayed instead of doing this to send it 3 times: mail($to,$subject,$message,$headers); mail($to,$subject,$message,$headers); mail($to,$subject,$message,$headers); Many thanks Link to comment https://forums.phpfreaks.com/topic/251385-line-duplication/ Share on other sites More sharing options...
phily245 Posted November 18, 2011 Share Posted November 18, 2011 Use a for loop, like the one below: <?php //Set the length $length = 10; //For however many time you specified above for ($p = 0; $p < $length; $p++) { //Send the email mail($to,$subject,$message,$headers); } ?> Link to comment https://forums.phpfreaks.com/topic/251385-line-duplication/#findComment-1289333 Share on other sites More sharing options...
ManiacDan Posted November 18, 2011 Share Posted November 18, 2011 The manual page on control structures contains a section on every kind of loop. -Dan Link to comment https://forums.phpfreaks.com/topic/251385-line-duplication/#findComment-1289351 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.