|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #48183 access to associative array element by key
Submitted: 2009-05-07 16:36 UTC Modified: 2009-05-12 12:37 UTC
From: foolged at inbox dot ru Assigned:
Status: Not a bug Package: Arrays related
PHP Version: 5.2.9 OS: windows xp sp3
Private report: No CVE-ID: None
 [2009-05-07 16:36 UTC] foolged at inbox dot ru
$a = array ('id'=>'abc');
if (isset($a['id']['BUG']))
  echo 'BUG!!!!!!!!';
$a = array ('id'=>'abc');
echo $a['id']['BUG']." <-BUGGGGG!!!!!!";  


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2009-05-07 16:59 UTC]
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.

 [2009-05-12 12:37 UTC] foolged at inbox dot ru
I understand that you want to say that this is a consequence of recourse to the string as to the array:
$ a = array ( 'id' => 'zxy');
echo $ a [ 'id'] [1]; // x

But such behavior should be when using a numeric key,
in the case of associative keys should be an error (an element with key 'BUG' not found).
PHP cast string 'BUG' to int 0 and returns $a['id'][0], it is logical to you?
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Mon Sep 27 06:03:38 2021 UTC