It is observed that every third number is fibonacci series is even. So, directly adding every third number to $sum, and got rid of if condition.