$successMsgArra y = array('image' => array('add_albu m' => 'Album:
"$album" has been created',
'edit_album' => 'Information for album "$album" has
been changed'));
[/PHP]
I am having to return the following in a class method:
[PHP]
return $successMsgArra y[$section][$action];
[/PHP]
Where the contents of $successMsgArra y[$section][$action] will have
the "placeholde rs" replaced by their variable values, so if you want
to return $successMsgArra y['image']['add_album'] you should see:
Album "Phil" has been createdWhere $album = 'Phil'
instead of
Album "$album" has been createdHow on earth do I do this? I have tried every combination of printf,
sprintf, echo, and eval that there could be done, to no avail. I'm
completely confused as to how to return this 2-dim array value into
something readable.
Here is the class method I have so far that fails miserably:
[PHP]
class MethodGenerator ForActionPerfor mer {
function &getSuccessMsg( ) { // STATIC STRING METHOD
global $section, $action, ${$section . 'LocationPath'} ,
$successMsgArra y;
if (is_array($_POS T) && @sizeof($_POST) > 0) foreach ($_POST as $key
=> $val) if (!isset(${$key} )) ${$key} = $val;
$this->fileName = ($_POST['image_name']) ? $_POST['image_name'] :
$this->fileName;
echo eval('$msg = ' . $successMsgArra y[$section][$action]);
return $msg;
}
}
[/PHP]
Thanx
Phil