I'm not sure that will exactly answer your question. But, you could build the command string, then pass it to exec and retrieve the result in an array.
--- BEGIN CODE ---
$params = array();
$params["PARAM1"] = "VAL1";
$params["PARAM2"] = "VAL2";
$params["PARAM3"] = "VAL3";
$params["PARAM4"] = "VAL4";
$cmd = "command<<EOF\n";
while ( list($param, $val) = each($params)) {
$cmd .= "\n$param=$val";
}
$cmd .= "\nEOF";
exec( $cmd, $output );
--- END CODE ---
I have not tried this code and don't know if this may work this way.
If this is not what you need, can you give a little more explanation on your needs.