Thanks dude,
That's some clear info you gave me, i appreciate it.
The problem is solved but now i have a very difficult script related to the array with subarray topic.
So i would like to make a challenge for simplifying. Not because i am lazy (i have worked 3 days on it) but because i believe some of you guys have far more notion about php then me.
This what i wrote a function for:
$framework = array(
'title',
'stage'=>array('width'=>'','height'=>'','color'=>''),
'values'=>array(),
'texts'=>array(),
'colors'=>array(),
'direction',
'system',
'margin'
);
$fruitstock = array(
'Fruit stock',
array(670,360,'FFFFFF'),
array(10,7,5,10,3,1,,
array('peren','appels','bananen','aardbeien','appelsienen','meloenen','bessen'),
array('D88A35','3377DB','DB338F','36D69C','CC3B3B','6C39D1','B1D337'),
'vertical',
'relative',
15
);
So my question is, is there a simple and dynamic function for adding the fruitstock array values to the framework without doing it manually?
At the moment I have 170 lines of code just to do this!
function procesinputs($framework,$statmap) {
$array = $framework;
$keys = array_keys($array);
$values = array_values($array);
$i = 0;
$j = 0;
while($i<count($array)) {
$key = $keys[$i];
$value = $value[$i];
if(is_numeric($key)) {
$inputs[$array[$j]] = $statmap[$i];
$j ++;
} else {
$subarray = $array[$key];
$subkeys = array_keys($subarray);
$subvalues = array_values($subarray);
$subinputs = array();
$k = 0;
$m = 0;
while($k<count($subarray)) {
$subkey = $subkeys[$k];
$subvalue = $subvalues[$k];
if(is_numeric($subkey)) {
$subinputs[$m] = $statmap[$i][$k];
$m ++;
} else {
$subinputs[$subkey] = $statmap[$i][$k];
}
$k ++;
}
$inputs[$key] = $subinputs;
}
$i ++;
}
return $inputs;
}
procesinputs($framework,$fruitstock);
I appreciate all the help!