2

I have an array like this:

$tmb = Array(
             [xThis] => 12400
             [fThat] => 7
             [cMore] => Array(
                    [236] => Array(
                        [acting_person] => "Test info"
                        [tThings] => "history"
                        )
                    )
               )
          )

I know how to call xThis(like $tmb['xThis'] but how do I call [acting_person] in a statement like this?

$new = $tmb['xThis'] . $tmb['fThat'] . ??????????????????

Sorry If this is elementary I am really new to PHP. Thanks.

3 Answers 3

1

You access (not "call") a subarray like this:

$tmb['cMore'][236]['acting_person']
Sign up to request clarification or add additional context in comments.

Comments

0

To access the acting_person item, you'd need to specify all of acting_person's parent keys. (You could theoretically have multiple acting_person keys in a multi-dimensional array, of course.)

$new = $tmb['xThis'] . $tmb['fThat'] . $tmb['cMore'][236]['acting_person'];

Comments

0

Its simple to access the value of any dimension of array

   $tmb['1st dimension'][2nd dimensin]['3rd dimension'][..][...][..]

even more just provide the key [key]

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.