0v1.ro

(zero V unu)

Strings array access issue

What would you expect for this script to output?

Maybe a notice? maybe some false there..
But if you have in mind PHP logic.. you surely know..

So, $text is a string and string characters can be accessed with $text[1] this is “b”
Then if you try $text[‘key’] PHP will typecast your ‘key’ to an integer (0) then $text[0] exists!

The second step is simple.. $text[0] is “a” and PHP logic again – any non empty string is true!

Output is: