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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T06:19:14+00:00 2026-05-16T06:19:14+00:00

I have an array $hourly = array( 01 => 0, 02 => 0, 03

  • 0

I have an array

$hourly = array(
        "01" => "0",
        "02" => "0",
        "03" => "0",
        "04" => "0",
        "05" => "0",
        "06" => "0",
        "07" => "0",
        "08" => "0",
        "09" => "0",
        "10" => "0",
        "11" => "0",
        "12" => "0",
        "13" => "0",
        "14" => "0",
        "15" => "0",
        "16" => "0",
        "17" => "0",
        "18" => "0",
        "19" => "0",
        "20" => "0",
        "21" => "0",
        "22" => "0",
        "23" => "0"
            );

And I have a bunch of data like “01” and “03” and “21” and I want to add (+1) to that specific value in the array. So with the data set “01”,”03″,”21″,”01″,”22″ the resulting array would be

$hourly = array(
        "01" => "2",
        "02" => "0",
        "03" => "1",
        "04" => "0",
        "05" => "0",
        "06" => "0",
        "07" => "0",
        "08" => "0",
        "09" => "0",
        "10" => "0",
        "11" => "0",
        "12" => "0",
        "13" => "0",
        "14" => "0",
        "15" => "0",
        "16" => "0",
        "17" => "0",
        "18" => "0",
        "19" => "0",
        "20" => "0",
        "21" => "1",
        "22" => "1",
        "23" => "0"
            );

How could I go about doing that? Is there a function to add 1 to an array element?

  • 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-16T06:19:15+00:00Added an answer on May 16, 2026 at 6:19 am
    $hours = array("01", "03", "21" );
    foreach($hours as $hour) {
       $hourly[$hour] += 1;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 497k
  • Answers 497k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer I'm not sure how you plan to do all of… May 16, 2026 at 12:00 pm
  • Editorial Team
    Editorial Team added an answer If you're running this after the image already has a… May 16, 2026 at 12:00 pm
  • Editorial Team
    Editorial Team added an answer Since servlets doesn't run inside the JSF context, you really… May 16, 2026 at 12:00 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I have an array like this: [234, 235 , 343, 445] I want to
I have this php that scores a test based on hourly answers: $score_a =
I have array of select tag. <select id='uniqueID' name=status> <option value=1>Present</option> <option value=2>Absent</option> </select>
I have an array of Image URl's from that array i have displayed my
I have an array filled with strings, a value can for example be not
I have an array which looks like this $dataArray = array ( 0 =>
I have the array example below that I am using to dynamically create an
I have an array and I want to sort by the number field not
I have an array, $scans. I want to query MySQL with all the values
I am working in PHP/MySQL. I have a table in my database called hourly

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.