Jump to content

is there an easier way to find the value of a key?


Recommended Posts

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;}

Edited by niche
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...