take new largest value
if ( $ mat [ $ i ] [ $ j ] > $ secondaryMax ) { $ secondaryMax = $ mat [ $ i ] [ $ j ] ; } } } } echo " Principal ▁ Diagonal ▁ Smallest ▁ Element : ▁ " , $ principalMin , " STRNEWLINE " ; echo " Principal ▁ Diagonal ▁ Greatest ▁ Element ▁ : ▁ " , $ principalMax , " STRNEWLINE " ; echo " Secondary ▁ Diagonal ▁ Smallest ▁ Element : ▁ " , $ secondaryMin , " STRNEWLINE " ; echo " Secondary ▁ Diagonal ▁ Greatest ▁ Element : ▁ " , $ secondaryMax , " STRNEWLINE " ; }