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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T04:30:08+00:00 2026-06-03T04:30:08+00:00

Array ( [Fixed Assets] => Array ( [0] => 150 [1] => Array (

  • 0
Array
(    [Fixed Assets] => Array
    (
        [0] => 150
        [1] => Array
            (
                [Equimpent] => Array
                    (
                        [0] => Office Computer
                        [1] => Office Printer
                    )
            )
        [2] => Array
            (
                [Furniture and Fixtures] => Array
                    (
                        [0] => Desk
                        [1] => Desk Chair
                    )
            )
    )
)

Employed as a heirarchial account naming and numbering schema, Account Numbers can be derived from the above sample array as follows…

  • Fixed Assets (Parent Account) #150
  • Equimpent (Child of Fixed Assets) #150-1
  • Furniture and Fixtures (Child of Fixed Assets) #150-2
  • Desk Chair (Child of Furniture and Fixtures) #150-2-1

My puzzle is how to code the addition of New Accounts to the array given
only the desired New Account Name,and the derived account number of its
target parent account.

For example…

<?php  
//Chart of Accounts
$coa = array('Fixed Asset'=>array(150,array('Equimpent'=>array('computer','printer')),array('Furniture and Fixtures'=>array('desk','chair'))));
//global $coa;
$new_account ="Office File Cabinet";//from ajax post
$target_base_no ="150-2";//from ajax post
//won't know if or how many subkeys will may be included 
//but would result in something like...

$coa['unknown_parent_of_acct_no_150'][2][] = $new_account;
?>

I’m totally blocked…
Reciprocally I suppose I might ask…
How might I determine the account name for account# 150-2 ?
Here is the COA array in context.

Array
(
[Cash Bank] => Array
    (
        [0] => 100
        [1] => Checking
        [2] => Paypal
        [3] => Petty Cash
        [4] => Savings
        [5] => Deposits Pending
    )

[Accounts Receivable] => Array
    (
        [0] => 110
        [1] => AR-AlternaMart
    )

[Inventory] => Array
    (
        [0] => 120
    )

[Other Current Assets] => Array
    (
        [0] => 130
        [1] => Pre-Paid Hosting
    )

[Fixed Assets] => Array
    (
        [0] => 150
        [1] => Array
            (
                [Equipment] => Array
                    (
                        [0] => Computer
                        [1] => Printer
                    )

            )

        [2] => Array
            (
                [Furniture And Fixtures] => Array
                    (
                        [0] => Desk
                        [1] => Desk Chair
                    )

            )

    )

[Accumulated Depreciation] => Array
    (
        [0] => 160
        [1] => AD-Computer
        [2] => AD-Printer
        [3] => AD-Desk
        [4] => AD-Desk Chair
    )

[Accounts Payable] => Array
    (
        [0] => 200
        [1] => AP-Unearned Shipping
    )

[Credit Cards Payable] => Array
    (
        [0] => 210
        [1] => Wells Fargo Visa
    )

[Sales Tax Payable] => Array
    (
        [0] => 220
        [1] => CO
        [2] => 80227
        [3] => 80214
        [4] => IL
    )

[Accrued Payroll Taxes] => Array
    (
        [0] => 230
    )

[Other Current Liabilities] => Array
    (
        [0] => 240
    )

[Loans Payable] => Array
    (
        [0] => 270
    )

[Notes Payable] => Array
    (
        [0] => 280
    )

[Capital] => Array
    (
        [0] => 300
    )

[Drawing] => Array
    (
        [0] => 320
    )

[Sales] => Array
    (
        [0] => 400
    )

[Other Income] => Array
    (
        [0] => 401
        [1] => Shipping
    )

[Commissions] => Array
    (
        [0] => 402
        [1] => AlternaMart Commissions
    )

[Sales Discounts] => Array
    (
        [0] => 450
    )

[Sales Returns and Allowances] => Array
    (
        [0] => 451
    )

[Shipping Discounts] => Array
    (
        [0] => 452
    )

[Reimbursed Shipping] => Array
    (
        [0] => 453
    )

[Cost of Goods Sold] => Array
    (
        [0] => 500
        [1] => COGS Shipping
    )

[Expense] => Array
    (
        [0] => 600
        [1] => BSC Checking
        [2] => Paypal Transaction Fees
        [3] => Alternamart Transaction Fees
        [4] => Commissions Expense
        [5] => Interest Expense
        [6] => Internet Service
        [7] => Web Hosting
        [8] => Rent Expense
        [9] => Telephone
        [10] => Utilities
        [11] => Postage
        [12] => Office Supplies
        [13] => Miscellaneous Supplies
        [14] => Advertising
        [15] => Salaries And Wages
        [16] => Payroll Taxes
        [17] => Dues And Subscriptions
        [18] => Miscellaneous Expenses
        [19] => Legal And Accounting
        [20] => Insurance
        [21] => Vehicles Expense
        [22] => Depreciation Expense
        [23] => Travel And Entertainment
        [24] => Bad Debt Expense
        [25] => Ask Accountant
    )

[Ask Accountant] => Array
    (
        [0] => 900
    )

)

  • 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-03T04:30:09+00:00Added an answer on June 3, 2026 at 4:30 am

    If I get it right:…

    Split $target_base_no by – $arr = explode('-', $target_base_no)
    Search your $coa array for value = 150 ($arr[0]), sth like that:

        foreach($coa as $row) {
           if ($arr[0] == $row[.....]
        }
    

    Use the second splited value ($arr[1]) to identify where to insert.

    Edited: You should create a reversed indexed array for a direct access to the right value. We are saving the nummeric values as keys and the text values as value (which can be used as index for the $coa array:

    $index = array();
    foreach($coa as $key => $value) {
         $index[$value[0]] = $key;
    }
    

    Afterwards you just access your data $coa[$index[$arr[0]]] (you should check if the field exists)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a method which returns an array of fixed type objects (let's say
I need to map a single fixed sized array array to multiple properties. For
I have an images array in which there are number of images. Not fixed,
I have a fixed array of constant integer values about 300 items long (Set
Is it possible in desktop GLSL to pass a fixed size array of floats
I have a few reasons to define a type for a fixed length array
My approach: An array of fixed-length (lets say 20) each element is pointer to
I have an array of fixed sized images that I want to display in
In c++, I can create a 2D array with fixed number of columns, say
I need to have a fixed-size array of elements and to call on them

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.