I'm wondering if the $count++ way of incrementing a counter is okay to use in a conditional statement? Will the variable maintain it's new value?
$count = 0;
foreach ($things as $thing){
if($count++ == 1) continue;
...
}
I'm wondering if the $count++ way of incrementing a counter is okay to use in a conditional statement? Will the variable maintain it's new value?
$count = 0;
foreach ($things as $thing){
if($count++ == 1) continue;
...
}
http://www.php.net/manual/en/language.operators.increment.php
To answer your question, that is perfectly valid, just keep in check that your value will be 2 after the if has been done.