Skip to main content

  | मौसम…

411 समाचार
Public archive edition · Attributed source reporting with original dates · AI drafts are excluded

411 REFERENCE · Wikibooks

Algorithms/Find maximum/Php method 1

Reference material by Wikibooks contributors. This retains its source identity and is not 411 news reporting.

<? function findMax($i_intaryTab){ if(count($i_intaryTab) == 1){ return $i_intaryTab[0]; } elseif(count($i_intaryTab) == 0){ return 0; } else{ $o_intMax = $i_intaryTab[0]; for($i = 1;$i < count($i_intaryTab);$i++){ if($i_intaryTab[$i] >$o_intMax){ $o_intMax = $i_intaryTab[$i]; } } return $o_intMax; } } $testArray = array(4,5,8,7,5,45,5777); echo findMax($testArray); ?>