php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #23876 Problem with multidimensional arrays
Submitted: 2003-05-29 14:11 UTC Modified: 2003-05-30 05:33 UTC
From: jkaufman at wamnet dot com Assigned:
Status: Not a bug Package: Scripting Engine problem
PHP Version: 4.3.2 OS: Mandrake Linux 9.1
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: jkaufman at wamnet dot com
New email:
PHP Version: OS:

 

 [2003-05-29 14:11 UTC] jkaufman at wamnet dot com
Given this data structure:

$user_master = array ('user_id'=>'user_id',                                         'user_name'=>'requester',                                                                                 'user_login'=>'login_name',                                                                                'user_region_id'=>'user_region');

$user_master['links']['user_region_id']='region_master["region_id"]';

The idea is to have one or more entries to relate certain db fields to other tables. If $tbl='user_master and $key='user_region_id', then if I do this:

if (array_key_exists('links', $$tbl))...
I get a true response. The key exists.

However, I cannot access the values using any of these contructs:

$value=$$tbl['links'][$key]
$values=array_values ($$tbl['links'])
if (array_key_exists($key, $$tbl['links'])
etc. etc.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-05-30 05:33 UTC] mgf@php.net
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

You want $value=${$tbl}['links'][$key] -- what you are trying is equivalent to $value=${$tbl['links'][$key]}
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Mon Aug 11 19:00:02 2025 UTC