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

  • Home
  • SEARCH
  • 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 8826481
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T07:08:55+00:00 2026-06-14T07:08:55+00:00

I have this if statement: if($_GET[angle_1] > 39) { $markers[###ANGLE###] = 45; } elseif($_GET[angle_1]

  • 0

I have this if statement:

if($_GET["angle_1"] > 39) {
    $markers["###ANGLE###"] = "45"; 
} elseif($_GET["angle_1"] > 29 && $_GET["angle_1"] < 40) { 
    $markers["###ANGLE###"] = "35"; 
} elseif($_GET["angle_1"] < 30) {
     $markers["###ANGLE###"] = "25"; 
} else { 
     $markers["###ANGLE###"] = "45"; 
}

Is there a better / simpler way to do this check, f.x. with round that will round the integer to the nearest 5, i.e. 28 -> 25 or 34 -> 35 etc. and in that, if the integer is less than 25, it will always be 25 and if the integer is higher than 45, it will always be 45 and again if the integer is between 30 and 40 it will always be 35.

That returned value will be used to display an image.

EDIT:

I have 3 images: image_25, image_35 and image_45, therefore the need to round.

  • 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-06-14T07:08:56+00:00Added an answer on June 14, 2026 at 7:08 am

    Let say $x has the number:

    $x = 39;
    

    If you want the closest multiple of 5 (39 –> 40):

    $x = round($x / 5) * 5;
    

    If you want to round up (36 –> 40):

    $x = ceil($x / 5) * 5;
    

    If you want to round down (39 –> 35):

    $x = floor($x / 5) * 5;
    

    After defining $x, you can use the following to make sure its in the 25-45 range:

    $x = ($x > 45) ? 45 : ($x < 25) ? 25 : $x;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have this MySQL statement from a search page, the user enters there postcode
I have this statement which is the wrong way to do it but how
I'm using gcc 4.7.0, in c89 mode. I have this if-else statement and have
I have this statement in my c program and I want to optimize. By
We have this statement: (SELECT res_bev.bev_id, property_value.name AS priority FROM res_bev, bev_property, property_value WHERE
I currently have this statement in my SQL View (SQL Server 2008 R2) which
I have this SQL statement: SELECT * FROM history WHERE (fk_person = 2119) AND
I have this mysql statement: SELECT `review_userid` , `book_id` , `review_id` , `user_class` ,
I have this sql statement: CREATE TABLE [dbo].[User]( [UserId] [int] IDENTITY(1,1) NOT NULL, [FirstName]
I have this if statement that tests for the 2 conditions below. The second

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.