This code should print the result in a green color if the condition are true and but instead it is print a blue color [like in the 'else' code]
<?php
$col = null;
$chek = 51200;
$chek -= 5200;
if ($chek / 1000 == 0 && (($chek % 10000) * 2) == 12000) {
$col = "style='color:green;'";
$save .= "$co . $a1 * $b1 = $span $col> $l </span> </br> </br>";
} else {
$col = "style='color:blue;'";
}
$res = "<span $col> $chek </span>";
echo $res;
The problem with this if($chek / 1000 == 0
Because 46000 / 1000 != 0
I think you want to put != rather than ==
I hope i helped you :)
$chek / 1000
= 46, not 0; therefore the if statement fails.
The code works if you change
if ($chek / 1000 == 0 && (($chek % 10000) * 2) == 12000) {
toif ($chek / 1000 == 0 || (($chek % 10000) * 2) == 12000) {
change your code:
if ($chek / 1000 == 0 && (($chek % 10000) * 2) == 12000)
to:
if (($chek / 1000 == 0) || (($chek % 10000) * 2) == 12000)
Hope it will help you.
if ($chek / 1000 == 0 && (($chek % 10000) * 2) == 12000) {
to
if ($chek / 1000 != 0 && (($chek % 10000) * 2) == 12000) {