Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP while loop add by 2

Currently I have a code that looks like:

for ($i=0; $i<=($num_newlines - 1); $i++) 
{
$tweetcpitems->post('statuses/update', 
                    array('status' => wordFilter("The item $parts[$i]  has been released on Club Penguin. View it here:   http://clubpenguincheatsnow.com/tools/swfviewer/items.swf?id=$parts[$id]")));
sleep(90);
}

What I want to do make the "i++" part add by two and not one, but how do I do this? Please help!

like image 508
S17514 Avatar asked May 24 '12 20:05

S17514


Video Answer


2 Answers

for ($i=0; $i<=($num_newlines - 1); $i+=2) {
like image 138
John Conde Avatar answered Oct 20 '22 22:10

John Conde


$i++ : increment by one

$i+=2 : increment by two

$i+=3 : increment by three

etc..

like image 36
just eric Avatar answered Oct 20 '22 23:10

just eric