Quote:
|
Originally Posted by paterson3713
Yeah you could do like:
Code:
$actions['val1'] = 'step1';
$actions['val2'] = 'step2';
// Then,
$action = $actions[$var];
Or, like it was also mentioned before, using a database:
Code:
// First, put the values into a mysql database like: value | action
// Then,
$action = @mysql_result(mysql_query('SELECT action FROM mySteps WHERE value=\''.mysql_escape_string($var).'\''),0);
|
Never mix storage with procedure. The easiest thing to do, would be something like:
$method = 'some' . $action;
if (method_exists(array(&$object, $method))) {
$function->$method;
}
I would do something like that ...