?:

I’m very new to php so I’m sure this is pretty basic. I need to translate the following into a else-if statement.

[php]<?php
$ch = 100 + (($a < $b) ? $a : $b) * 15;
?> [/php]

$a and $b can any interger

I just can’t get my head around this.

Any help would be great.

Cheers
Brad

hi use below code instead of your current code. [php] //use this code $a=50; $b=60; // $a & $b are integer values. if($a < $b) { $re = $a; } else { $re = $b; } echo $ch = 100+$re*15; [/php] I hope this will helpful for you. Reply your feedback. ~~SR~~

Would this do the same thing?
[php]$a = 10;
$b = 5;

if ($a < $b){
echo $ch = 100 + $a * 15;
}
else {
echo $ch = 100 + $b * 15;
}
?>
[/php]

If you get rid of the ‘echo’ part, yes.

Yes, your newly posted code is doing same thing as my code.

SR

Sponsor our Newsletter | Privacy Policy | Terms of Service