Boundary elements of a Matrix | PHP program to print boundary element of matrix . ; Driver code
< ? php $ MAX = 100 ; function printBoundary ( $ a , $ m , $ n ) { global $ MAX ; for ( $ i = 0 ; $ i < $ m ; $ i ++ ) { for ( $ j = 0 ; $ j < $ n ; $ j ++ ) { if ( $ i == 0 ) echo $ a [ $ i ] [ $ j ] , " ▁ " ; else if ( $ i == $ m - 1 ) echo $ a [ $ i ] [ $ j ] , " ▁ " ; else if ( $ j == 0 ) echo $ a [ $ i ] [ $ j ] , " ▁ " ; else if ( $ j == $ n - 1 ) echo $ a [ $ i ] [ $ j ] , " ▁ " ; else echo " ▁ " , " ▁ " ; } echo " STRNEWLINE " ; } } $ a = array ( array ( 1 , 2 , 3 , 4 ) , array ( 5 , 6 , 7 , 8 ) , array ( 1 , 2 , 3 , 4 ) , array ( 5 , 6 , 7 , 8 ) ) ; printBoundary ( $ a , 4 , 4 ) ; ? >