• sparklette

    (@sparklette)


    Hi. I am very new to PHP coding in general and hope someone can answer this query.

    Let’s say I have this if/else statement running on my WordPress theme that displays specific texts when certain conditions are fulfilled:

    <?php {
    	if (condition) {
    		echo "sample text";
    	} else if (second condition) {
    		echo "sample text 2";
    	} else if (third condition) {
    		echo "sample text 3";
    	} else {
    		echo "sample text 4";
    	}
    } ?>

    The conditions are is_page(), is_home(), is_single() etc. Does this cause heavy load on the server? Thanks.

Viewing 2 replies - 1 through 2 (of 2 total)
  • If it does we are all screwed. ??

    Sure, an if statement is more load than having no statement, but in most cases you are measuring in thousandths, tens of thousandths, or better of a second. And why use a scripting language like PHP if you aren’t going to script stuff?

    Thread Starter sparklette

    (@sparklette)

    That makes sense. It’s good news for me. Thanks ??

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Do php if/else statements cause heavy load on the server?’ is closed to new replies.