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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T18:17:05+00:00 2026-05-20T18:17:05+00:00

I have an array of all possible combinations of values, a bit like working

  • 0

I have an array of all possible combinations of values, a bit like working out what monetary values I could make with only certain coins. Now I have an array built but much of the useful data are keys and not values.

A small snippet is below:
Each root key is an array with keys total, denomination and quantity. Each of the quantities multiplied by the denominations total the total. While I’ve been able to access the total easily enough I just can’t get a handle on the denominations and the quantities.

It’s my plan to output to separate radio buttons like so:

foreach($array as $arr)
{
    echo '<input type="radio" name="name" value="'.$arr[$total].'">';
    foreach($arr[denom] as $index => $d)
    {
        echo $d[qty][$index].' x '.$d[denom][$index].' = '.($qty[$index]*$denom[$index]).'<br>';
    }
}

Here’s the array I have, any help would be much appreciate, I’m usually great at this bot it’s driving me crazy

Array
(
    [2] => Array
        (
            [total] => 105
            [denom] => Array
                (
                    [0] => 105
                )

            [qty] => Array
                (
                    [0] => 1
                )

        )

    [3] => Array
        (
            [total] => 210
            [denom] => Array
                (
                    [0] => 105
                )

            [qty] => Array
                (
                    [0] => 2
                )

        )

    [4] => Array
        (
            [total] => 300
            [denom] => Array
                (
                    [0] => 300
                )

            [qty] => Array
                (
                    [0] => 1
                )

        )

    [5] => Array
        (
            [total] => 405
            [denom] => Array
                (
                    [0] => 300
                    [1] => 105
                )

            [qty] => Array
                (
                    [0] => 1
                    [1] => 1
                )

        )

    [6] => Array
        (
            [total] => 500
            [denom] => Array
                (
                    [0] => 500
                )

            [qty] => Array
                (
                    [0] => 1
                )

        )

    [7] => Array
        (
            [total] => 605
            [denom] => Array
                (
                    [0] => 500
                    [1] => 105
                )

            [qty] => Array
                (
                    [0] => 1
                    [1] => 1
                )

        )
  • 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-20T18:17:06+00:00Added an answer on May 20, 2026 at 6:17 pm

    Constant non-numeric array indices should be written like any other string, i.e. encapsulated in quotes.

    foreach($array as $arr) {
        echo '<input type="radio" name="name" value="'.$arr['total'].'">';
        foreach($arr['denom'] as $index => $d){
            for ($j = 0;$j < count($denom);$j++) {
                echo $d['qty'][$j].' x '.$d['denom'][$j].' = ';
                echo ($d['qty'][$j]*$d['denom'][$j]) . '<br>';
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an array of array like below with all numeric values. I want
I'm trying to find all possible combinations of a word, and have certain letters
I want to enumerate all possible combinations of elements array. For example: I have
I have an array of values all well within the range 0 - 63,
I just have the array of 15 values that all need to be inserted
Hello Im trying to get all possible combinations with repetitions of given char array.
i need to discover all possible combinations for some arrays that have an specific
The goal is to have an array where all strings are of length n.
I have an array returned by the function Search.all : => [#<Search id: 7,
I have an array in php that contains all the lines of a text

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.