Check if current element is less than firstmin , then update first , second and third
if ( $ array [ $ i ] < $ firstmin ) { $ thirdmin = $ secmin ; $ secmin = $ firstmin ; $ firstmin = $ array [ $ i ] ; }