Saturday, September 5, 2015

function for min number from array - manually

<?php

function min_number($array){
    $min_number = $array[0];
    $length = count($array);
    for($i = 0; $i < $length; $i++){
        if($min_number > $array[$i]){
           $min_number = $array[$i];
        }
    }
    return $min_number;
}

No comments:

Post a Comment

css snippet for blogger code highlighting

code, .code {     display: block;     background: beige;     padding: 10px;     margin: 8px 15px; }