I have an array $var (see structure below), which contains AN, AU, TI, PY ... etc. (28 
in total - no teasing.) How can access these keys so I can do this:

foreach key in $var until $var.length
{
if(!$something){$something = filter_strings("something: ",$line);}
}

So I can avoid doing this 28 times:

 if(!$AN){$AN = filter_strings("AN: ",$line);}
 if(!$AU){$AU = filter_strings("AU: ",$line);}
 if(!$TI){$TI = filter_strings("TI: ",$line);}
 if(!$PY){$PY = filter_strings("PY: ",$line);}
...

and this 28 times.

if($AN) {DisplayLine('AN',$AN);}
if($AU) {DisplayLine('AU',$AU);}
if($TI) {DisplayLine('TI',$TI);}
if($PY) {DisplayLine('PY',$PY);}
...


$var = array (
 'AN' => array (
 'Description' => 'ERIC_NO: (AN)',
 'Input'       => 'EricAN',
 'Select'      => 'SelAN',
 'Option'      => 'AN',
 'Selected'    => 'AN «Annotation»'
 ),
 'AU' => array (
 'Description' => 'AUTHOR: (AU)',
 'Input'       => 'EricAU',
 'Select'      => 'SelAU',
 'Option'      => 'AU',
 'Selected'    => 'AU «Author»'
 ),
 'TI' => array (
 'Description' => 'TITLE: (TI)',
 'Input'       => 'EricTI',
 'Select'      => 'SelTI',
 'Option'      => 'TI',
 'Selected'    => 'TI «Title»'
 ),
 'PY' => array (
 'Description' => 'PUBLICATION_DATE: (PY)',
 'Input'       => 'EricPY',
 'Select'      => 'SelPY',
 'Option'      => 'YR',
 'Selected'    => 'YR «Year of Publication»'
 ),
24 more to go.
)



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to