Jump to content

Referencing two-dimension array records...


Rohlan

Recommended Posts

Hi everyone.

 

I've been trying to figure this out for hours now and I'm feeling like throwing down the towel... though I'm sure I'm very close to finding the way to do it... I've googled a bit but I don't think I know very well what to search about...

 

This is my array (its a big one get ready):

 

Array
(
    [quartos] => Array
        (
            [designacao] => Array
                (
                    [0] => 1
                    [1] => 2
                )

            [dimensoes] => Array
                (
                    [0] => 1
                    [1] => 2
                )

            [andar] => Array
                (
                    [0] => 1
                    [1] => 2
                )

            [janelas] => Array
                (
                    [0] => 1
                    [1] => 2
                )

            [pavimentos] => Array
                (
                    [0] => 1
                    [1] => 2
                )

            [mobilia] => Array
                (
                    [0] => 1
                    [1] => 2
                )

            [obs] => Array
                (
                    [0] => 1
                    [1] => 2
                )

            [extras] => Array
                (
                    [0] => in
                    [1] => in
                )

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

        )

    [wcs] => Array
        (
            [designacao] => Array
                (
                    [0] => 1
                    [1] => 2
                )

            [dimensoes] => Array
                (
                    [0] => 1
                    [1] => 2
                )

            [andar] => Array
                (
                    [0] => 1
                    [1] => 2
                )

            [janelas] => Array
                (
                    [0] => 1
                    [1] => 2
                )

            [pavimentos] => Array
                (
                    [0] => 1
                    [1] => 2
                )

            [mobilia] => Array
                (
                    [0] => 1
                    [1] => 2
                )

            [obs] => Array
                (
                    [0] => 1
                    [1] => 2
                )

            [extras] => Array
                (
                    [0] => in
                    [1] => in
                )

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

        )

)

 

What I need to do is turn these values into a string. However I can't seem to be able to obtain the values themselves.

 

I know I can simply

 

echo $array[quartos][designacao][0]
echo $array[quartos][designacao][1]
echo $array[quartos][designacao][2]
echo $array[quartos][designacao][3]
.
.
.

 

But I need a loop to iterate through the array and do it without having to do it manually.

 

I just can't seem to find out how to do it...

 

Any ideas?

 

Thank you.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.