Multidimensional array

Ask about general coding issues or problems here.

Moderators: egami, macek, gesf

Post Reply
gunitinug
New php-forum User
New php-forum User
Posts: 4
Joined: Tue Apr 17, 2018 10:35 pm

Fri Jun 22, 2018 3:00 am

What is this multidimensional array? I don't understand its syntax.

Code: Select all

Array
(
    [0] => Array
        (
            [hashtag] => a7e87329b5eab8578f4f1098a152d6f4
            [title] => Flower
            [order] => 3
        )

    [1] => Array
        (
            [hashtag] => b24ce0cd392a5b0b8dedc66c25213594
            [title] => Free
            [order] => 2
        )

    [2] => Array
        (
            [hashtag] => e7d31fc0602fb2ede144d18cdffd816b
            [title] => Ready
            [order] => 1
        )
)

gunitinug
New php-forum User
New php-forum User
Posts: 4
Joined: Tue Apr 17, 2018 10:35 pm

Fri Jun 22, 2018 3:12 am

I think it is equivalent to

Code: Select all

array(
	array(
		"hashtag"=>"a7e87329b5eab8578f4f1098a152d6f4",
		"title"=>"Flower",
		"order"=>"3"
	),
	array(
		"hashtag"=>"b24ce0cd392a5b0b8dedc66c25213594",
		"title"=>"Free",
		"order"=>"2"
	),
	array(
		"hashtag"=>"e7d31fc0602fb2ede144d18cdffd816b",
		"title"=>"Ready",
		"order"=>"1"
	)
)

User avatar
hyper
php-forum Fan User
php-forum Fan User
Posts: 755
Joined: Mon Feb 22, 2016 5:52 pm

Fri Jun 22, 2018 10:51 am

The first listing is incorrect for PHP, I think that you're correct that the second listing is what was intended.

chorn
php-forum Fan User
php-forum Fan User
Posts: 563
Joined: Fri Apr 01, 2016 2:18 am

Sun Jun 24, 2018 9:47 pm

The first one is just the text representation from print_r(). The second is the php-source-code equivalent to get there.

Post Reply