title: Why is a multi dimensional array with one array different than more than one array?
body: <p>I'm not sure if I phrased this correctly, but basically, I have two arrays (see below). The first array only has one "segment" array, but when doing a var_dump, it shows an array of it's children (or not at all).</p>
  
  <p>The bigger array has multiple "segment" arrays, and in the var_dump, you can see the array(5). </p>
  
  <p>Background is I am getting these two array from a json string that I decode in php. </p>
  
  <p>Here are the arrays:
  Json:</p>
  
  <pre><code>{ "css": { "segment": { "type": "Body", "comments": "Launch Pad v4 theme.css", "rule": { "selector": "html", "declaration": [ { "property": "margin", "value": "0" }, { "property": "padding", "value": "0" }, { "property": "height", "value": "100%" }, { "property": "background", "value": "#fff url(body_bg.gif) repeat-x top" } ] } } } }
  </code></pre>
  
  <p>Array:</p>
  
  <pre><code>    array(1) {
    ["css"]=&gt;
    array(1) {
      ["segment"]=&gt;
      array(3) {
        ["type"]=&gt;
        string(4) "Body"
        ["comments"]=&gt;
        string(23) " v4 theme.css"
        ["rule"]=&gt;
        array(2) {
          ["selector"]=&gt;
          string(4) "html"
          ["declaration"]=&gt;
          array(4) {
            [0]=&gt;
            array(2) {
              ["property"]=&gt;
              string(6) "margin"
              ["value"]=&gt;
              string(1) "0"
            }
            [1]=&gt;
            array(2) {
              ["property"]=&gt;
              string(7) "padding"
              ["value"]=&gt;
              string(1) "0"
            }
            [2]=&gt;
            array(2) {
              ["property"]=&gt;
              string(6) "height"
              ["value"]=&gt;
              string(4) "100%"
            }
            [3]=&gt;
            array(2) {
              ["property"]=&gt;
              string(10) "background"
              ["value"]=&gt;
              string(34) "#fff url(body_bg.gif) repeat-x top"
            }
          }
        }
      }
    }
  }
  </code></pre>
  
  <p>Json:</p>
  
  <pre><code>{ "css": { "segment": [ { "type": "Body", "comments": "Launch Pad v4 theme.css", "rule": [ { "selector": "html", "declaration": [ { "property": "margin", "value": "0" }, { "property": "padding", "value": "0" }, { "property": "height", "value": "100%" }, { "property": "background", "value": "#fff url(body_bg.gif) repeat-x top" } ] }, { "selector": "body", "declaration": [ { "property": "font", "value": "12px Arial, Helvetica, sans-serif" }, { "property": "line-height", "value": "1.35", "comments": "Specify default line height as a pure number value (no px/em)...adjusting the value as desired. This will allow the line-height to flex depending on what size the user specifies their text within the rich text editor" }, { "property": "color", "value": "#333" } ] } ] }, { "type": "Fonts/Typography", "comments": "Fonts/Typography" }, { "type": "Header" }, { "type": "Content" }, { "type": "Footer" } ] } }
  </code></pre>
  
  <p>Array</p>
  
  <pre><code>array(1) {
        ["css"]=&gt;
        array(1) {
          ["segment"]=&gt;
          array(5) {
            [0]=&gt;
            array(3) {
              ["type"]=&gt;
              string(4) "Body"
              ["comments"]=&gt;
              string(23) "theme.css"
              ["rule"]=&gt;
              array(2) {
                [0]=&gt;
                array(2) {
                  ["selector"]=&gt;
                  string(4) "html"
                  ["declaration"]=&gt;
                  array(4) {
                    [0]=&gt;
                    array(2) {
                      ["property"]=&gt;
                      string(6) "margin"
                      ["value"]=&gt;
                      string(1) "0"
                    }
                    [1]=&gt;
                    array(2) {
                      ["property"]=&gt;
                      string(7) "padding"
                      ["value"]=&gt;
                      string(1) "0"
                    }
                    [2]=&gt;
                    array(2) {
                      ["property"]=&gt;
                      string(6) "height"
                      ["value"]=&gt;
                      string(4) "100%"
                    }
                    [3]=&gt;
                    array(2) {
                      ["property"]=&gt;
                      string(10) "background"
                      ["value"]=&gt;
                      string(34) "#fff url(body_bg.gif) repeat-x top"
                    }
                  }
                }
                [1]=&gt;
                array(2) {
                  ["selector"]=&gt;
                  string(4) "body"
                  ["declaration"]=&gt;
                  array(3) {
                    [0]=&gt;
                    array(2) {
                      ["property"]=&gt;
                      string(4) "font"
                      ["value"]=&gt;
                      string(33) "12px Arial, Helvetica, sans-serif"
                    }
                    [1]=&gt;
                    array(3) {
                      ["property"]=&gt;
                      string(11) "line-height"
                      ["value"]=&gt;
                      string(4) "1.35"
                      ["comments"]=&gt;
                      string(216) "Specify default line height as a pure number value (no px/em)...adjusting the value as desired. This will allow the line-height to flex depending on what size the user specifies their text within the rich text editor"
                    }
                    [2]=&gt;
                    array(2) {
                      ["property"]=&gt;
                      string(5) "color"
                      ["value"]=&gt;
                      string(4) "#333"
                    }
                  }
                }
              }
            }
            [1]=&gt;
            array(2) {
              ["type"]=&gt;
              string(16) "Fonts/Typography"
              ["comments"]=&gt;
              string(16) "Fonts/Typography"
            }
            [2]=&gt;
            array(1) {
              ["type"]=&gt;
              string(6) "Header"
            }
            [3]=&gt;
            array(1) {
              ["type"]=&gt;
              string(7) "Content"
            }
            [4]=&gt;
            array(1) {
              ["type"]=&gt;
              string(6) "Footer"
            }
          }
        }
      }
  </code></pre>
  
  <p>My question is how can I force a array when there is only 1 array in the "segment", or why is that even happening? </p>
  
  <p>Edit:</p>
  
  <p>What I am asking is this, why is it in the smaller array, there is only one "segment" array and I do a count on it, shows 3. It shows "comments", "type", and array "rules" which are all children of "segment". Now in the bigger array, where there are more than 1 "segment" rows, the count is 5, and each "segment" has an array with "comments", "type", and array "rules", not as direct children.</p>