Hi all,
I need to run a check within a for loop (which could be up to 30,000 iterations ($count)). Which would be faster & why?
for ($x=0;$x<$count;$x++) {
if ($item === "$a") {
} elseif ($item === "$b") {
} elseif ($item === "$c") {
} 17 more time (20 total)
}
OR
for ($x=0;$x<$count;$x++) {
switch($item) {
case '$a'; break;
case '$b'; break;
case '$c'; break;
17 more as above
}
}
between if/elseif's and case/breaks i would do "something."
....wondering if anyone would know offhand if one or the other would be faster, or has done some benchmarking regarding this type of question.
Thanks!