Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6886221
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T05:43:56+00:00 2026-05-27T05:43:56+00:00

unable to get my else if statement to work, does anyone have any ideas?

  • 0

unable to get my else if statement to work, does anyone have any ideas? it works without the else if….

$waveFeet = round("$ar2");
        if ($waveFeet >= 2) {
            echo $waveFeet - 1;
        }
        else if ($waveFeet > 5) {
            echo $waveFeet - 2;
        }

        else 
        {
            echo "$wavefeet";   
        }

also as a side question, can anyone tell me how to change my round() to make it always round (down) instead of rounding up or down…?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T05:43:56+00:00Added an answer on May 27, 2026 at 5:43 am

    you can use floor for down round

    $waveFeet = floor($ar2);                
    
    if ($waveFeet > 5)
        echo $waveFeet - 2;
    else if ($waveFeet >= 2) 
        echo $waveFeet - 1;
    else 
        echo $wavefeet;   
    

    you have to first check for 5 bcz 5 is big no than 2 and your first condition >= 2 also satisfied if no >5 so control go to first condition rather than second….

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm unable to get this jquery statement to work on page load but it
I have a seemingly simple problem though i am unable to get my head
I have the following code and I am still unable to get Hibernate to
I have a SELECT CASE statement that I am trying to get working. Essentially
I have a drop down but i am unable to get the value of
I have been unable to get Riak working under Ubuntu 9 due to many
I'm unable to get this function to work. The if always return false. What
I am unable to get any feedback from my Facebook FB.UI() method. I am
I am unable to get the correct title for this, please change the title
I am unable to get a highcharts plugin to render a chart in a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.