if ($variable) not always the same as if ($variable == 0)
Agaric school of coding mistakes lesson of the day
This, when $node->price equaled zero (actually, and significantly, 0.00), did not give the proper result:
if ($node->price) {
$default_value = $node->price;
}
While this did work as expected:
if ($node->price > 0) {
$default_value = $node->price;
}
Moral of the story: don't be lazy.
Agaric school of coding mistakes lesson of the day
This, when $node->price equaled zero (actually, and significantly, 0.00), did not give the proper result:
if ($node->price) {
$default_value = $node->price;
}
While this did work as expected:
if ($node->price > 0) {
$default_value = $node->price;
}
Moral of the story: don't be lazy.
More like this
- Suggested terms - module which solves part of the same problem CMT tackles
- Remember return $variables line in function _phptemplate_variables
- Variables available in _phptemplate_variables for node templates
- Subform limitations: errors in subform not noted or highlighted the same as main form
- Debug variable printing functions shortcuts


Comments
Post new comment