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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T03:38:36+00:00 2026-05-27T03:38:36+00:00

Can someone please explain how to obtain this result from the following array? Here

  • 0

Can someone please explain how to obtain this result from the following array? Here is the result I am looking for:

Array
(
    [Nov 18, 2011] => Array
        (
            [C] => 2
            [I] => 1
        )

    [Nov 22, 2011] => Array
        (
            [C] => 2
        )

)

And here is the array with the raw data:

Array
(
    [0] => Array
        (
            [0] => Array
                (
                    [Nov 18, 2011] => C
                )

            [1] => Array
                (
                    [Nov 18, 2011] => C
                )

            [2] => Array
                (
                    [Nov 18, 2011] => I
                )

        )

    [1] => Array
        (
            [0] => Array
                (
                    [Nov 22, 2011] => C
                )

            [1] => Array
                (
                    [Nov 22, 2011] => C
                )

        )

)

The first array shown represents the the count of items for each element of the inner array, which is what I am trying to summarize from the next array. Thanks.

  • EDIT –

Here is the query which generates the above arra:

$qrybilled = $this->db->query("SELECT tbltc.BILLED FROM tbltc WHERE tbltc.PN = $pn AND tbltc.Y = $taxyear AND tbltc.SCENARIO = $scenario GROUP BY BILLED");
$x = 0; $arr_billed = array();

foreach ($qrybilled->result() as $row) {
$qry3 = $this->db->query("SELECT tbltc.* FROM tbltc WHERE tbltc.PN = $pn AND tbltc.Y = $taxyear AND tbltc.SCENARIO = $scenario AND tbltc.BILLED = '".$row->BILLED."' GROUP BY TC ORDER BY CAT ASC, TC ASC");

    $tmp3 = array();
    foreach ($qry3->result() as $row) {     
        $tmp3[] = array( date("M d, Y",strtotime($row->BILLED)) => $row->CAT);
    }
    $arr_billed3[] = $tmp3; 

}
$data['billed3'] = $arr_billed3; 
  • 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-27T03:38:37+00:00Added an answer on May 27, 2026 at 3:38 am
    $arr[0][] = array('Nov 18, 2011'=>'C');
    $arr[0][] = array('Nov 18, 2011'=>'C');
    $arr[0][] = array('Nov 18, 2011'=>'I');
    
    $arr[1][] = array('Nov 22, 2011'=>'C');
    $arr[1][] = array('Nov 22, 2011'=>'C');
    
    $result = array();
    foreach($arr as $key=>$value){
        foreach($value as $k=>$v){
            foreach($v as $_k=>$_v){
                if(isset($result[$_k][$_v])){
                    $result[$_k][$_v]++;
                }
                else {
                    $result[$_k][$_v] =1;
                }
            }
        }
    }
    

    Array result:

    print_r($result);
    
    Array
    (
        [Nov 18, 2011] => Array
            (
                [C] => 2
                [I] => 1
            )
    
        [Nov 22, 2011] => Array
            (
                [C] => 2
            )
    
    )
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can someone please explain to me why this simple assignment doesn't work. Here is
Can someone please explain why this program outputs 0x00000004? class AndAssignment { static void
Can someone please explain what the & does in the following: class TEST {
Can someone please explain how to understand a logcat from an android force close.
Can someone please explain what really goes on in this code ? If I
Can someone please explain why this test fails: [Fact] public void ResolveAllDoesNotReturnServicesRegisteredInParent() { //
Can someone please explain the structure of this line of a script for me?
Can someone please explain what the following function does. I am learning Asp.net MVC
Can someone please explain what this means? Enum<T extends Enum<T>> This seems like a
Can someone please explain what is going on here with the Django Tutorial Part

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.