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.
Comments
Post new comment