i found the solution but i don't know why this first code is faster (i put 14 in order to try to make more clear the code) the only difference is that i eliminate the for i wrote for a huge if
if($num%14==0 && $num%13==0 &&$num%12==0 &&$num%11==0 &&$num%10==0 && $num%9==0 && $num%8==0 && $num%7==0 && $num%6==0 && $num%5==0 && $num%4==0 && $num%3==0 && $num%2==0 && $num%1==0){
$notFound=0;
}
why is this second code hugely more slow than the first one? With the for it suppose to be faster. is the same in another languages???
$notFound=0;
for ( $i=14; $i>=2 && notFound==0; $i--){
if($num%$i!=0){
$notFound=1;
}
}