SirChick Posted October 2, 2007 Share Posted October 2, 2007 I been wondering which way is the correct way to code this .... i have 5 variables i need to add together then multiply by 5. So i got this: $Total = $StrengthInput + $DexterityInput + $DefenceInput + $AgilityInput * 5; Then i wondered would it be better to do this: $Total = $StrengthInput + $DexterityInput + $DefenceInput + $AgilityInput; $NewTotal = $Total * 5; Quote Link to comment https://forums.phpfreaks.com/topic/71542-solved-multiply-a-number-of-variables/ Share on other sites More sharing options...
trq Posted October 2, 2007 Share Posted October 2, 2007 <?php $Total = ($StrengthInput + $DexterityInput + $DefenceInput + $AgilityInput) * 5; ?> Quote Link to comment https://forums.phpfreaks.com/topic/71542-solved-multiply-a-number-of-variables/#findComment-360209 Share on other sites More sharing options...
SirChick Posted October 2, 2007 Author Share Posted October 2, 2007 Argh ok thankyou. Quote Link to comment https://forums.phpfreaks.com/topic/71542-solved-multiply-a-number-of-variables/#findComment-360210 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.