PHP if statement comparison clarity -
i having problem php. i'm new it, driving me batty! falsify() function below works. if compare (falsify == false), echo false, why necessary? why falsify not return false without comparison?;
<?php if (falsify) { echo "true"; } else { echo "false"; } function falsify(){ return false; } ?>
if use undefined constant, php assumes mean name of constant itself, if called string (
constantvs"constant"). error of levele_noticeissued when happens. see manual entry on why$foo[bar]wrong (unless firstdefine() barconstant) ...
http://www.php.net/manual/en/language.constants.syntax.php
falsify without () implicit string:
var_dump(falsify); var_dump(falsify()); function falsify() { return false; } produces:
string(7) "falsify" bool(false) the first evaluates true, hence if seeing logically true.
Comments
Post a Comment