Jump to content

comparison operators


mrneilrobinson

Recommended Posts

$result = ($mean > $medium);
echo 'Result is '.(($result) ? 'true' : 'false').'<br />';

 

The ternary operator may not be the best thing to show a beginner who doesn't know about conditional statements....

Perhaps

 

but he understands enough to know that

$result = ($mean > $medium);

will give him a boolean value in $result.... a lot of beginners wouldn't appreciate that.

Link to comment
https://forums.phpfreaks.com/topic/168024-comparison-operators/#findComment-886302
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.