Edit report at http://bugs.php.net/bug.php?id=51794&edit=1

 ID:               51794
 Updated by:       dtajchre...@php.net
 Reported by:      schmunk at usrbin dot de
 Summary:          String keys in arrays are treated as 0, if not set
-Status:           Open
+Status:           Bogus
 Type:             Bug
 Package:          Arrays related
 Operating System: OS X 10.6
 PHP Version:      5.3.2

 New Comment:

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

"Warning



Writing to an out of range offset pads the string with spaces.
Non-integer types are converted to integer. Illegal offset type emits
E_NOTICE. Negative offset emits E_NOTICE in write but reads empty
string. Only the first character of an assigned string is used.
Assigning empty string assigns NUL byte."



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


Previous Comments:
------------------------------------------------------------------------
[2010-05-11 16:07:58] schmunk at usrbin dot de

Description:
------------
I tried to access an array key by string value.

But the variable I accessed was no array, but a string.



As stated in the manual you can access single chars by numeric array
keys, which 

makes perfect sense.

But if I try to use a string it is treated as 0 (zero).



Too much type jugglin'?

Test script:
---------------
<?php 

  $link = "foo";

  echo $link['bar'];

?>

Expected result:
----------------
PHP NOTICE - $link['bar'] is not defined.

Actual result:
--------------
f


------------------------------------------------------------------------



-- 
Edit this bug report at http://bugs.php.net/bug.php?id=51794&edit=1

Reply via email to