Why does accessing array index on boolean value does not raise any kind of error?

后端 未结 1 1024
盖世英雄少女心
盖世英雄少女心 2020-12-11 16:03

When I try to access an array by key which is not exists in this array, php will raise \"undefined index\" notice error. When I try to do the same on strings, \"Illegal stri

相关标签:
1条回答
  • 2020-12-11 16:36

    It's sad, but it's documented behaviour.

    http://php.net/manual/en/language.types.string.php

    Note:

    Accessing variables of other types (not including arrays or objects implementing the appropriate interfaces) using [] or {} silently returns NULL.

    0 讨论(0)
提交回复
热议问题