0

I am a little bit in doubt, if this is a correct notation in a three dimensional array. This is just a part of my code, but when I run the code I get an error, where it says I need ')'.

$property = array(
    "green" => array(
        "numbers" => array(1 => "#ffffff"
    ),
    "yellow" => array(
        "numbers" => array(6 => "#81c77d"
    ),
    "white" => array(
        "numbers" => array(24 => "#81e87c"
    ),
    "grey" => array(
        "numbers" => array(0 => "#ffffff"
    ),
    "red" => array(
        "numbers" => array(34 => "#dfb07b"
    )
);
0

3 Answers 3

1

You are missing parentheses - they are always needed to pair up. It should look like this:

$property = array(
    "green" => array(
        "numbers" => array(1 => "#ffffff")
    ),
    "yellow" => array(
        "numbers" => array(6 => "#81c77d")
    ),
    "white" => array(
        "numbers" => array(24 => "#81e87c")
    ),
    "grey" => array(
        "numbers" => array(0 => "#ffffff")
    ),
    "red" => array(
        "numbers" => array(34 => "#dfb07b")
    )
);

Use an IDE like Eclipse or Aptana Studio which will show you the syntax errors while you type so that you won't need to run the code to see something is wrong.

Sign up to request clarification or add additional context in comments.

Comments

1
$property = array(
    "green" => array(
        "numbers" => array(1 => "#ffffff")
    ),
"yellow" => array(
    "numbers" => array(6 => "#81c77d")
),
"white" => array(
    "numbers" => array(24 => "#81e87c")
),
"grey" => array(
    "numbers" => array(0 => "#ffffff")
),
"red" => array(
    "numbers" => array(34 => "#dfb07b")
)
);

Parenthesis after the hex code

Comments

1
$property = array(
    "green" => array(
        "numbers" => array(1 => "#ffffff")
    ),
    "yellow" => array(
        "numbers" => array(6 => "#81c77d")
    ),
    "white" => array(
        "numbers" => array(24 => "#81e87c")
    ),
    "grey" => array(
        "numbers" => array(0 => "#ffffff")
    ),
    "red" => array(
        "numbers" => array(34 => "#dfb07b")
    ),
);

You missed parenthesis.

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.