ich ein Formular erstellt haben, und legt sie als Array,Suche max von einem Array, das aus einem Formular Vorlage erstellt
array(
'name' => 'John',
'score1' => '50',
'score2' => '90',
'score3' => '75',
);
Ich möchte das Maximum suchen, von dem eingereichten Array, aber es immer erkannt als Zeichenfolge. So das Ergebnis immer John
<form action="" method='post'>
<?php
$dr = array('Brian','Mike','John');
$prd = array('score1','score2','score3');
foreach($dr AS $d){
echo "<input name=txt[$d][dr] value='".$d."' size=3 readonly>";
foreach($prd AS $p){
echo "<input type=text name=txt[$d][".$p."] size=3 value=0> ";
}
echo "<hr>";
}
?>
<input type='submit' name='submit'>
</form>
<?php
if($_POST['submit']){
foreach($_POST['txt'] AS $v){
$max = max($v);
$v['max'] = $max;
var_dump($v);
}
}
?>
Code: http://phpfiddle.org/lite/code/9tnu-p6yd