niche Posted October 12, 2010 Share Posted October 12, 2010 This has to be accomplished with a known variable ($x) that doubles as a key and an array that may or may not contain the key in $x?$x = 'LAMS_ZV9014';$foo = array("LAMS_ZV9014" => "25.00" , "ABC" => "10.00" );if (array_key_exists($x, $foo)) { $bar = $foo['LAMS_ZV9014']; echo $bar;} Link to comment Share on other sites More sharing options...
ShadowMage Posted October 12, 2010 Share Posted October 12, 2010 Not sure I understand the question. Link to comment Share on other sites More sharing options...
wirehopper Posted October 12, 2010 Share Posted October 12, 2010 if (isset($foo[$x])) $value=$foo[$x];else $value='bar'; Link to comment Share on other sites More sharing options...
niche Posted October 12, 2010 Author Share Posted October 12, 2010 That qualifies.Thanks to ShadowMage and wirehopper for their help. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.