Dis is mijn code.:
<?php
echo 'fixed array 3:<br>'; //next step is to use an sql-result
$documentVersion = array(
8 => array(1,2,3,4,5,6,7),
9 => array(1,2,3,4,5,6),
10 => array(1,2,5,4,5,6)
);
echo '<pre>'.print_r($documentVersion, true).'</pre>';
//determine maximum per $documentVersion['key'] and put in an array $documentMaxFileVersion with $documentId as key en $maxFileVersion as value
$documentMaxFileVersion = array();
foreach($documentVersion as $documentId => $fileVersion)
{
echo $documentId.': ';
$maxFileVersion = max($fileVersion).'<br>';
echo $maxFileVersion;
//place in array $documentMaxFileVersion with $documentId as key and $maxFileVersion as value.
//And I get stuck here because I some can't figure out how to fill the array
}
echo '<br>';
/*Het result of the foreachloop has to be (in this case):
*$documentenMaxBestandenVersies = array(8 => 7, 9 => 6, 10 => 6)
*Who can put me back on track?
*/
echo '<pre>'.print_r($documentMaxFileVersion, true).'</pre>';
?>Bij voorbaat dank!