ShaolinF Posted October 19, 2007 Share Posted October 19, 2007 Hey Guys, How can I multiply 2 digits ? I have a $_SESSION['var'] and £3.50 which I need to add. Quote Link to comment https://forums.phpfreaks.com/topic/73989-solved-mulitplying/ Share on other sites More sharing options...
pocobueno1388 Posted October 19, 2007 Share Posted October 19, 2007 <?php $result = $_SESSION['var'] * 3.50; echo $result; ?> That will multiply whatever value is in the session with 3.50. Quote Link to comment https://forums.phpfreaks.com/topic/73989-solved-mulitplying/#findComment-373441 Share on other sites More sharing options...
ShaolinF Posted October 19, 2007 Author Share Posted October 19, 2007 Thanks, what if I wanted to round it off at 2 decimals ? Quote Link to comment https://forums.phpfreaks.com/topic/73989-solved-mulitplying/#findComment-373450 Share on other sites More sharing options...
kernelgpf Posted October 19, 2007 Share Posted October 19, 2007 Then you'd use: <?php $result = round($_SESSION['var'] * 3.50,2); echo $result; ?> Quote Link to comment https://forums.phpfreaks.com/topic/73989-solved-mulitplying/#findComment-373458 Share on other sites More sharing options...
pocobueno1388 Posted October 19, 2007 Share Posted October 19, 2007 Go Robyn! -cheers- (everyone can just ignore that but her ) Quote Link to comment https://forums.phpfreaks.com/topic/73989-solved-mulitplying/#findComment-373467 Share on other sites More sharing options...
ShaolinF Posted October 19, 2007 Author Share Posted October 19, 2007 That didnt work. Quote Link to comment https://forums.phpfreaks.com/topic/73989-solved-mulitplying/#findComment-373471 Share on other sites More sharing options...
pocobueno1388 Posted October 19, 2007 Share Posted October 19, 2007 Could you tell us what didn't work about it? Also, show us your code (if you changed anything) Quote Link to comment https://forums.phpfreaks.com/topic/73989-solved-mulitplying/#findComment-373473 Share on other sites More sharing options...
ShaolinF Posted October 19, 2007 Author Share Posted October 19, 2007 It works now: number_format($_SESSION['TICKET'] * 3.50,2); Quote Link to comment https://forums.phpfreaks.com/topic/73989-solved-mulitplying/#findComment-373487 Share on other sites More sharing options...
pocobueno1388 Posted October 19, 2007 Share Posted October 19, 2007 Don't forget to solve Quote Link to comment https://forums.phpfreaks.com/topic/73989-solved-mulitplying/#findComment-373490 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.