Jump to content

[SOLVED] Set variable with condition statement


Yangshuo

Recommended Posts

for your reference (if you need to refer to this again), it is called a ternary operator.

 

var isPostive = (x > 0)?true:false

 

is also a waste, since an IF statement is a boolean operation anyway.  It can be rewritten in PHP as:

 

$isPositive = ($x > 0);

 

Hope this helps.

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.