A
while( x < 100 ) {
if( x == 1 ) { echo "Hello World!" } else { echo "Bottles" }
x++;
}
B
while( x < 100 ) {
if( x != 1 ) { echo "Bottles" } else { echo "Hello World!"}
x++;
}
Would it really make a difference when having such a big loop?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
It probably won’t make a difference.
I’d go with the second one, as it is more often that
x != 1than it will be thatx == 1This probably translates into super-tiny-1-thousandths-of-a-millisecond performance increase, but micro-optimization isn’t that important.