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. 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. 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 ? 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; ?> 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 ) 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. 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) 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); 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 Link to comment https://forums.phpfreaks.com/topic/73989-solved-mulitplying/#findComment-373490 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.