I have another question, before I was wondering about if vs switch, and it turns out switch was faster, now I am again asking, which is faster? for or foreach? I am using the following code on my site and the array I am using contains about 35 values. I tried a foreach, and it seemed alittle fast, but I couldn't really tell, and I dont wana just think its faster..here is the code I use
for($i = 0; $i <= $total_illegal; $i++){
if(strpos(strtolower($_SERVER['REQUEST_URI']), $illegal[$i]) !== FALSE){
log_suspect($illegal[$i]);
$stop = 3;
}
}
If i used a foreach this is wat it would look like
foreach($illegal as $variable => $value){
if(strpos(strtolower($_SERVER['REQUEST_URI']), $illegal[$variable]) !== FALSE){
log_suspect($illegal[$variable]);
$stop = 3;
}
}
Which one operates faster or would most likely operate faster? because speed is a rather important thing atm,..