Jump to content

what is the difference?


CyberShot

Recommended Posts

I am working with wordpress and I see a lot of "if" statements done like this

 

if(condition):

    do something

endif;

 

 

I have always done it like so

 

if(condition) {

  do something

 

}

 

what is the difference? does the first method have any advantages over the second method?

Link to comment
https://forums.phpfreaks.com/topic/233117-what-is-the-difference/
Share on other sites

what is the difference? does the first method have any advantages over the second method?

 

Some folks prefer the "alternative" syntax when mixing HTML or other blocks of output with basic PHP, especially when mixing different types of control blocks (loops, conditions, etc.) where the closing statement (endwhile, endif, etc.) is much clearer than a random curly brace . Outside of that, it's not very common at all to it.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.