Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
0

Php question

Guest
May 25, 2009 May 25, 2009

Copy link to clipboard

Copied

I have this calculation: <?php echo $subTotal + $shipTotal; ?>

where $shipTotal should be 50 if $shipTotal is more or the same as 50.

This is what I have found out so far:

<?php
if ($shipTotal < 50) {
    echo $shipTotal;
} elseif ($shipTotal >= 50) {
    echo "50";
}
?>

But I don't know how to put it in the calculation (so that $shipTotal is not getting more than 50).

Thankx for any further help and tips.

TOPICS
Server side applications

Views

361
Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

LEGEND , May 25, 2009 May 25, 2009

You're nearly there.

<?php
if ($shipTotal >= 50) {
    $shipTotal = 50;
}

echo $subTotal + $shipTotal;

?>

Votes

Translate
LEGEND ,
May 25, 2009 May 25, 2009

Copy link to clipboard

Copied

LATEST

You're nearly there.

<?php
if ($shipTotal >= 50) {
    $shipTotal = 50;
}

echo $subTotal + $shipTotal;

?>

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines