php min() array is returing wrong from foreach -


i calculating , getting result , array function in foreach loop , min() or max() on result result wrong. can explain me why? thanks

function subtract($a, $b){     $c=$b-$a;     return $c. ',';     }     $r=3; $numbers = array(12, 11, 6, 9, 15);  foreach ($numbers $index=>$value) {     $deductions[]=array(subtract($r, $value));     $minimum=min($deductions); } print_r($minimum); 

i 12 instead of 3 in case.

function subtract($a, $b){     $c=$b-$a;     return $c;     }     $r=3; $numbers = array(12, 11, 6, 9, 15);  foreach ($numbers $index=>$value) {     $deductions[]=array(subtract($r, $value));     $minimum=min($deductions); } echo min($minimum); 

Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -