0

I have the following array:

Array
(
    [A3L791B03M-YLWS] => 1
    [A3L791B03MBLKS5] => 1
    [A3L791B05M-BLKS] => 2
    [A3L791B05M-BLU] => 1
    [A3L791B05M-BLUS] => 1
    [A3L791B05M-GRY] => 2
    [A3L791B05M-H-S] => 1
    [A3L791B05M-REDS] => 1
    [A3L791B05M-S] => 2
    [A3L791B05M-WHTS] => 2
    [A3L791B05M-YLWS] => 2
    [A3L791B10M-BLKS] => 2
    [A3L791B10M-BLUS] => 2
    [A3L791B10M-GRNS] => 1
    [A3L791B10M-GRY] => 2
    [A3L791B10M-REDS] => 1
    [A3L791B10M-S] => 3
    [A3L791B10M-S?KIT] => 1
    [A3L791B10M-WHTS] => 2
    [A3L791B10M-YLWS] => 1
)

However, when I try to call for the data of A3L791b10M-S via:

echo $array_mysku_count['A3L791b10M-S'];

However, when I do so, I get the following error:

Fatal error: Uncaught exception 'Exception' with message 'Notice: Undefined index: A3L791b10M-S in...

All the other keys seems to be fine. Anything that is specific about this key that is causing this?

3 Answers 3

2

You're using the key A3L791b10M-S but it's actually A3L791B10M-S. Note the uppercase B there.

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

Comments

2

A3L791B10M-S is different from A3L791b10M-S. Watch the case...

Comments

1

Change the b to upper case.

A3L791B10M-S

You also may be interested in the strtoupper function.

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.