Jump to content

[SOLVED] 3D Arrays hate me


Crew-Portal

Recommended Posts

<?php	
$config=
	array('site'=>
		array('connection'=>
			array('database'=>'SECRET',
				'username'=>'SECRET',
				'password'=>'SECRET',
				'location'=>'localhost'),
		array('settings'=>
			array('backgroundcolor'=>'#CEE1E9',
				'contentcolor'=>'#FFFFFF',
				'sidebarcolor'=>'#C8D1D5',
				'textcolor'=>'#000000',
				'linkcolor'=>'#002E6E',
				'backgroundimage'=>null,
				'disposition'=>1),
			),
		array('name'=>
			array('sitename'=>'None',
				'slogan'=>'None',
				'language'=>'English'),
			),
		array('sessions'=>
			array('username'=>$_SESSION['valid_user'],
				'user_id'=>$_SESSION['user_id']),
			),
		)
	)
;?>

 

Why cant I access my arrays like..

 

$config['site']['settings']['backgroundcolor'];

 

I cant figure it out. And im not getting any errors..

Link to comment
https://forums.phpfreaks.com/topic/171272-solved-3d-arrays-hate-me/
Share on other sites

I surrounded the array with <PRE></PRE> and got:

 

Array
(
    [site] => Array
        (
            [connection] => Array
                (
                    [database] => SECRET
                    [username] => SECRET
                    [password] => SECRET
                    [location] => localhost
                )

            [0] => Array
                (
                    [settings] => Array
                        (
                            [backgroundcolor] => #CEE1E9
                            [contentcolor] => #FFFFFF
                            [sidebarcolor] => #C8D1D5
                            [textcolor] => #000000
                            [linkcolor] => #002E6E
                            [backgroundimage] => 
                            [disposition] => 1
                        )

                )

            [1] => Array
                (
                    [name] => Array
                        (
                            [sitename] => None
                            [slogan] => None
                            [language] => English
                        )

                )

            [2] => Array
                (
                    [sessions] => Array
                        (
                            [username] => 
                            [user_id] => 
                        )

                )

        )

)

 

Does that shed any light on the situation? Cause I understand that I dont have the arrays grouped properly. But sadly I dont know how to fix it :'(

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.