All values are numbers. But do they become text strings that I need to change before doing simple math on them?
$newoverall_total =
$row_Movie['overall'] + $HTTP_POST_VARS['overall'];
$newoverall_votes = ++$row_Movie['overall_votes'];
$newoverall = $newoverall_total/$newoverall_votes;
Thnaks for any help.
Ron R
Do I have to prep $strings prior to math functions?
Moderator: General Moderators
php uses implicit typecasting almost everywhere
Code: Select all
<?php
$a = '1';
$b = ' 2 ';
$c = '3dron';
$d = 'nord3';
echo $a+$b, "<br />\n";
echo $a+$c, "<br />\n";
echo $a+$d, "<br />\n";
echo ($b == 2) ? 'true':'false', "<br />\n";
// but
echo ($b === 2) ? 'true':'false';
?>