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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T03:26:02+00:00 2026-05-16T03:26:02+00:00

Given the following dates: 6/30/2010 – 7/6/2010 and a static variable: $h = 7.5

  • 0

Given the following dates:

6/30/2010 - 7/6/2010

and a static variable:

$h = 7.5

I need to create an array like:

Array ( [2010-06-30] => 7.5 [2010-07-01] => 7.5 => [2010-07-02] => 7.5 => [2010-07-05] => 7.5 => [2010-07-06] => 7.5) 

Weekend days excluded.

No, it’s not homework…for some reason I just can’t think straight today.

  • 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-16T03:26:03+00:00Added an answer on May 16, 2026 at 3:26 am

    For PHP >= 5.3.0, use the DatePeriod class. It’s unfortunately barely documented.

    $start = new DateTime('6/30/2010');
    $end = new DateTime('7/6/2010');
    $oneday = new DateInterval("P1D");
    
    $days = array();
    $data = "7.5";
    
    /* Iterate from $start up to $end+1 day, one day in each iteration.
       We add one day to the $end date, because the DatePeriod only iterates up to,
       not including, the end date. */
    foreach(new DatePeriod($start, $oneday, $end->add($oneday)) as $day) {
        $day_num = $day->format("N"); /* 'N' number days 1 (mon) to 7 (sun) */
        if($day_num < 6) { /* weekday */
            $days[$day->format("Y-m-d")] = $data;
        } 
    }    
    print_r($days);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Given following array: var arr = [undefined, undefined, 2, 5, undefined, undefined]; I'd like
Given following Ruby statements: (Read input and store each word in array removing spaces
// given following array: $data = array( 0=>array( data=>object1, col=>array( 0=>array( data=>object2, col=>array( 0=>array(
Given the following code : import java.io.*; public class Main { public static void
Given the following table format... id | date | value ___|____________|______ 11 | 2010-01-01
What I would like to do is as follows Given two dates e.g. March
This should not be this hard. I simply need the following: SET @DueDate =
To get TimeSpan in minutes from given two Dates I am doing the following
Given the following set of records, I'd like to return the first occurrence of
Given the following dataset for a single article on my site: Article 1 2/1/2010

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.