May I take this opportunity to wish everyone effected by those tragic events on 9/11 in the USA ,my best on this sad day. We will never forget you. God bless.
Just my sentiment for the day - now to more mundane matters.
Is it possible to make an array of functions and if so how can I adapt my syntax to do so?
Here is my code
if (isset($_POST['submit'])) {
$answer = array();
$answer[1] = $_REQUEST['improvement'];
$answer[2] = $_REQUEST['planning'];
$answer[3] = $_REQUEST['confidence'];
$answer[4] = $_REQUEST['motivation'];
$answer[5] = $_REQUEST['resources'];
$answer[6] = $_REQUEST['integration'];
$answer[7] = $_REQUEST['diagnosis'];
$answer[8] = $_REQUEST['change'];
$answer[9] = $_REQUEST['expectations'];
$answer[10] = $_REQUEST['validated'];
$answer[11] = $_REQUEST['size_org'];
$answer[12] = $_REQUEST['time'];
$answer[13] = $_REQUEST['demand'];
$answer[14] = $_REQUEST['external_support'];
$answer[15] = $_REQUEST['training'];
$answer[16] = $_REQUEST['complexity'];
$answer[17] = $_REQUEST['depth'];
$answer[18] = $_REQUEST['part'];
$answer[19] = $_REQUEST['cost'];
function pqasso($answers) {
foreach($answers as $key=>$value)
{
if($value >= "3")
{
$score = $score + 1000;
}
else
{
$score = $score - 1000;
}
}
return $score;
}
function iip($answers) {
foreach($answers as $key=>$value)
{
if($value >= "3")
{
$score = $score + 1000;
}
else
{
$score = $score - 1000;
}
}
return $score;
}
function iso9000($answers) {
foreach($answers as $key=>$value)
{
if($value >= "3")
{
$score = $score + 1000;
}
else
{
$score = $score - 1000;
}
}
return $score;
}
What I am trying to do is place each of the functions above into an array and then go onto have a scoring feedback system which loops through the array of functions to work create conditional echo statements like so:
for each function if the $score = X then echo 'the following functions are relevant:'
(list of functions with $score of X here)
else for each function if $score = Y then echo 'the following functions may be relevant
(list of functions with $score of Y here)
else..... etc
Hope this makes sense! thanks in advance