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 6046225
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T07:12:51+00:00 2026-05-23T07:12:51+00:00

i need help for this task. i need a for loop who picks the

  • 0

i need help for this task.

i need a for loop who picks the closest duration

sample we have a duration with 120 seconds the 120 seconds are on every calculation divided by 8
so here is an example

120 Duration

Here are the 8 closest values
15
30
45
60
75
90
105
120

How i can realize this i have all tested

<?php
$count = 1;
$duration = 120;
$temp = 0;
for ($x = 1; $x < 120; $x++) {
    #$j = $x / 8;
    $temp = $x / 8;
    echo '<pre>' . ($temp) . '</pre>';

    if ($count == 8) {
        break;
    }
    $count++;
}
?>
  • 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-23T07:12:52+00:00Added an answer on May 23, 2026 at 7:12 am

    Your question is quite unclear and the provided code doesn’t go from 1->120 since you break it after 8 iterations.
    To get the values 15 30 45 60 75 90 105 120 from the base 120 you would need something like this:

    $result = array();
    $duration = 120; //the duration in seconds as provided in the example
    $divider = 8; //the divider 8 as provided by the example
    
    for ($i = 1; $i <= $divider; $i++) {
        //This will give 1* 120/8 = 15 for the first run
        //2* 120/8 = 30 for the second and so on
        $result[] = (int) $i * $duration / $divider;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need help in this matter: We have a template of Excel file in
Can anyone help me with this? I have a task to write a function,
Need help! I've been looking for a solution for this seemingly simple task but
I need help on this following aspx code aspx Code: <asp:Label ID =lblName runat
I need help with this route map routes.MapRoute(Blog_Archive, Blog/Archive/{year}/{month}/{day}, new { controller = Blog,
I need help finishing this statement. It is frustrating that two of the PHP
I really need help on this one. I am having a simple login form
Not exactly about programming, but I need help with this. I'm running a development
Sorry to bother again, but I really need help transforming this Python2 code into
Need some help with this problem in implementing with XSLT, I had already implemented

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.