Shakhawat Posted October 25, 2015 Share Posted October 25, 2015 i am new php learner . i need help from group to learn batter php program.i cannot create solve this help me please . my code:html:<form action="chake.php" method="post"> <input type="number" name="one" placeholder="enter your number" required /><input type="number" name="two" placeholder="enter your number" required /><input type="submit" value ="enter"/> </form>php:<?php$left_operand =$_POST["one"];$right_operand =$_POST["two"]; $output =bccomp($right_operand ,$right_operand);if($output == 0){echo 'equal';}elseif ($output > 0){echo $right_operand.' is biger then '.$left_operand;}else{echo $left_operand.' is bigger then '.$right_operand ;} ?> Quote Link to comment https://forums.phpfreaks.com/topic/298815-php-intigar-compair/ Share on other sites More sharing options...
Ch0cu3r Posted October 25, 2015 Share Posted October 25, 2015 Should you not be comparing $left_operand with $right_operand here? $output =bccomp($right_operand ,$right_operand); As it is you are comparing $right_operand with $right_operand Also you have the variables in the wrong way round in the echo statements elseif ($output > 0){ echo $right_operand.' is biger then '.$left_operand; } else{ echo $left_operand.' is bigger then '.$right_operand ; } They should be the other way round. Quote from php.net Return ValuesReturns 0 if the two operands are equal, 1 if the left_operand is larger than the right_operand, -1 otherwise. That is saying if $left_operand is greater then $right_operand it will return 1, otherwise it will return -1 if $right_operand is greater then $left_operand. Quote Link to comment https://forums.phpfreaks.com/topic/298815-php-intigar-compair/#findComment-1524273 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.