Jump to content

explain php syntax?


ollie007

Recommended Posts

That is a shorthand way of writing an if statement..

 

http://www.tech-recipes.com/rx/288/php-if-statement-syntax/

 

http://www.scottklarr.com/topic/446/shorthand-php-if-statement-without-the-else-notation/

 

$variable = (statement) ? "return if true" : "return if false";

//# Compared to

if(statement) {
    $variable = "return this if true"; 
} else { 
    $variable = "return this if false";
}

 

Link to comment
https://forums.phpfreaks.com/topic/161250-explain-php-syntax/#findComment-850859
Share on other sites

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.