Checking if an array key exists

From: Date: Wed, 28 May 2003 20:12:09 +0000
Subject: Checking if an array key exists
Groups: php.general 
Request: Send a blank email to php-general+get-149313@lists.php.net to get a copy of this message
I have a multi-dimensional array. Looks like this: $work_order_hdr = array ('whdr_id'=>'record_no', 'whdr_order_no'=>'request_no', 'whdr_site_id'=>'site_id', 'whdr_user_id'=>'user_id', 'whdr_location'=>'location', 'whdr_date_submitted'=>'date_submitted', 'whdr_date_acknowledged'=>'date_acknowledged', 'whdr_date_approved'=>'date_approved', 'whdr_date_rejected'=>'date_rejected', 'whdr_date_cancelled'=>'date_cancelled', 'whdr_date_closed'=>'date_closed', 'whdr_status'=>'status'); $work_order_hdr['links']['whdr_site_id']='site_master["site_id"]'; $work_order_hdr['links']['whdr_user_id']='user_master["user_id"]'; I use the a part of the array to display the field names from the db in a more user-friendly manner. The 'links' part is new and is intended to link certain fields to fields in other tables. I have a variable called '$tbl' that contains a table name, in this case $tbl='work_order_hdr'. I can reference 'whdr_id' like this: echo $$tbl['whdr_id'] That gives the expected 'record_no' I can't seem to access the links correctly. I've tried various combinations of 'isset' and 'array_key_exists' but can't find the correct syntax. The system in question is running php 4.1.2. Suggestions? -- Jim Kaufman mailto:jmk@linuxforbusiness.net Linux Evangelist cell: 612-481-9778 public key 0x6D802619 fax: 952-937-9832 http://www.linuxforbusiness.net

« previous php.general (#149313) next »