AzeS Posted July 28, 2016 Share Posted July 28, 2016 (edited) Title says it all... I tried it this way: <?php $THROWOUT_PAYED_FULL = number_format((float)$BUYEDFULL, 2, '.', $BUYEDHALF); echo $THROWOUT_PAYED_FULL; #echo's 1.0 #goal is: 1.1 ?> Any suggestions ? Edited July 28, 2016 by AzeS Quote Link to comment https://forums.phpfreaks.com/topic/301666-how-do-i-put-two-int-to-one-float-like-int1int2/ Share on other sites More sharing options...
requinix Posted July 28, 2016 Share Posted July 28, 2016 Try $THROWOUT_PAYED_FULL = (float)($BUYEDFULL . '.' . $BUYEDHALF); Quote Link to comment https://forums.phpfreaks.com/topic/301666-how-do-i-put-two-int-to-one-float-like-int1int2/#findComment-1535198 Share on other sites More sharing options...
AzeS Posted July 28, 2016 Author Share Posted July 28, 2016 echo's two.. doesnt work Quote Link to comment https://forums.phpfreaks.com/topic/301666-how-do-i-put-two-int-to-one-float-like-int1int2/#findComment-1535199 Share on other sites More sharing options...
requinix Posted July 28, 2016 Share Posted July 28, 2016 Does too. https://3v4l.org/v5Cdt Quote Link to comment https://forums.phpfreaks.com/topic/301666-how-do-i-put-two-int-to-one-float-like-int1int2/#findComment-1535202 Share on other sites More sharing options...
Solution Barand Posted July 28, 2016 Solution Share Posted July 28, 2016 As this is a math help forum $x=1; $y=1; $z = $x + $y/10; echo $z; Quote Link to comment https://forums.phpfreaks.com/topic/301666-how-do-i-put-two-int-to-one-float-like-int1int2/#findComment-1535207 Share on other sites More sharing options...
Barand Posted July 28, 2016 Share Posted July 28, 2016 More generalized case $x=1; $y=111; $z = $x + $y/pow(10,strlen($y)); Quote Link to comment https://forums.phpfreaks.com/topic/301666-how-do-i-put-two-int-to-one-float-like-int1int2/#findComment-1535211 Share on other sites More sharing options...
AzeS Posted July 28, 2016 Author Share Posted July 28, 2016 Solved thanks alot !! Quote Link to comment https://forums.phpfreaks.com/topic/301666-how-do-i-put-two-int-to-one-float-like-int1int2/#findComment-1535227 Share on other sites More sharing options...
AzeS Posted July 28, 2016 Author Share Posted July 28, 2016 <?php $BUYEDFULL = 1000; $BUYEDHALF = 120; for ($i=0; $i < $BUYEDHALF; $i++) { if($i = 100 ) { $BUYEDFULL++; $BUYEDHALF = $BUYEDHALF - 100; $i = 0; } } $x=$BUYEDFULL; $y=$BUYEDHALF; $z = $x + $y/100; echo "<br>".$z; ?> Quote Link to comment https://forums.phpfreaks.com/topic/301666-how-do-i-put-two-int-to-one-float-like-int1int2/#findComment-1535231 Share on other sites More sharing options...
requinix Posted July 28, 2016 Share Posted July 28, 2016 Quote Link to comment https://forums.phpfreaks.com/topic/301666-how-do-i-put-two-int-to-one-float-like-int1int2/#findComment-1535236 Share on other sites More sharing options...
AzeS Posted July 29, 2016 Author Share Posted July 29, 2016 Quote Link to comment https://forums.phpfreaks.com/topic/301666-how-do-i-put-two-int-to-one-float-like-int1int2/#findComment-1535259 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.