ptmuldoon
03-16-2010, 01:06 AM
Its been a while since I've look at php, and every thing I know is self taught...
I'm trying to search an array comparing its key and, than to return the value when a match is found. I think I'm on the right track, but can't seem to get it quite right. Can any give a few pointers?
[php]
// List of sub actions.
$subactions = array(
'browser' => 'MainBrowser',
'create' => 'CreateGame'
);
// What are we doing?
if (isset($_REQUEST['sa']) && array_key_exists($_REQUEST['sa'], $subactions))
{
//$context['sub_template'] = $subactions[1]; //Should this work?
$context['sub_template'] = 'CreateGame';
}[/code]
I'm trying to search an array comparing its key and, than to return the value when a match is found. I think I'm on the right track, but can't seem to get it quite right. Can any give a few pointers?
[php]
// List of sub actions.
$subactions = array(
'browser' => 'MainBrowser',
'create' => 'CreateGame'
);
// What are we doing?
if (isset($_REQUEST['sa']) && array_key_exists($_REQUEST['sa'], $subactions))
{
//$context['sub_template'] = $subactions[1]; //Should this work?
$context['sub_template'] = 'CreateGame';
}[/code]